Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,990
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    Sorry, you are boring me.

    What I said was

    "But alerts are considered to be obsolete. In practice you should use DOM methods to display a message to your user."

    Any sensible person would interpret that as referring to document.getElementById() and innerHTML.

    I have never heard anyone claim that alert() was a DOM method. But you may be right - on a geeky and pedantic level. Why are you seeking to start a pointless argument? How can your intervention be of the slightest use to the OP?

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  2. #17
    New Coder
    Join Date
    Aug 2013
    Posts
    50
    Thanks
    0
    Thanked 11 Times in 11 Posts
    Wow, don't take it so personally. I know what you meant. I just wanted to make sure you (and everyone else) knew where alert and such came from.

  3. #18
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,990
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    It is apparant that alert() and prompt() are defined in the browser simply from viewing the different way (appearance) in which they are rendered in different browsers.

    What practical difference that makes eludes me. But my point was that alerts are obsolete and should not be used. That is true however they originate, DOM method or not.

    Edit: alert() may well be defined in the browser but like Airblader I do not think that makes it part of the HTML DOM. So I think that the statement that alert() is a method of the DOM is not correct. I agree with Airblader - It may be part of every DOM's implementation, but it is not part of the DOM.
    Last edited by Philip M; 10-10-2013 at 11:28 AM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  4. #19
    Regular Coder
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    578
    Thanks
    4
    Thanked 77 Times in 77 Posts
    I have searched my way through the different DOM level specifications and I can't find any mention of a specified(!) method named like that. Unfortunately, it also doesn't seem to be specified anywhere else and to me it looks like it's a method that every implementation seems to have, but which is not part of the underlying specification that is implemented. Not entirely surprising, knowing how mixed up all the different implementations are, and yet interesting to see that every browser supports it.

    In other words: It may be part of every DOM's implementation, but it is not part of the DOM.
    Just because every implementation of an interface implements another method, doesn't make this method be part of the interface.

    However, I might just be missing something. So if anyone can point me to where it is actually defined, if it is, I'd be glad to see it. But I'd be surprised to find it to be a part of the DOM as it has nothing to do with the DOM, really. I'd expect it to be part of the Javascript specification, or maybe a completely different specification. But I'm happy to be proven wrong.
    Last edited by Airblader; 10-10-2013 at 09:37 AM.

  5. #20
    Regular Coder
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    578
    Thanks
    4
    Thanked 77 Times in 77 Posts
    And I'm sorry for reviving this discussion. I actually find it very interesting to see where such a commonly used (even if not recommended) method is defined. But in terms of truth I also think it's important to give a prove of why it allegedly is part of the DOM – at least I couldn't verify that right away (but neither could I disprove it reliably, I just tend to assume it's wrong unless I find prove that it is true).
    Last edited by Airblader; 10-10-2013 at 09:59 AM.

  6. #21
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,335
    Thanks
    11
    Thanked 588 Times in 569 Posts
    Quote Originally Posted by Airblader View Post
    I have searched my way through the different DOM level specifications and I can't find any mention of a specified(!) method named like that. Unfortunately, it also doesn't seem to be specified anywhere else and to me it looks like it's a method that every implementation seems to have,
    ...

    However, I might just be missing something. So if anyone can point me to where it is actually defined, if it is, I'd be glad to see it. But I'd be surprised to find it to be a part of the DOM as it has nothing to do with the DOM, really. I'd expect it to be part of the Javascript specification, or maybe a completely different specification. But I'm happy to be proven wrong.
    did you really look? HTML5 is not very obscure imho... i'll chalk it up to a "senior moment" because i know you do good work around here...


    http://www.w3.org/TR/html5/webappapis.html#dom-alert


    a rose by any other name would still smell so sweet. who cares where it came from, it's just there. as my mom used to say when she didn't understand something: "that's just how god made it". also, alert's not in node.js, webworkers, ASP classic, and many other JS implementations that follow (or try to follow) the ECMAScript spec.

    to me, this is not surprising, the spec doesn't even spec "window", much less its methods...
    Last edited by rnd me; 10-10-2013 at 05:24 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  7. #22
    Regular Coder
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    578
    Thanks
    4
    Thanked 77 Times in 77 Posts
    I mostly focused on the DOM spec, since that is what this was about. I read that it is part of the HTML5 spec, but that can't be where it originates from, since it existed before HTML5.

    a rose by any other name would still smell so sweet. who cares where it came from, it's just there. as my mom used to say when she didn't understand something: "that's just how god made it"
    I guess after a year of working for an international company as a customer with countless specs and documents to write and update every day, I sort of got used to thinking "in specs". And seeing how much implementations differ in this area, it feels worth knowing to me where particular things are even specified. And there are quite a few cases where the spec matters – for example when it comes to decide whether something is a bug or intended behavior.

    In any case, at least being part of HTML5 strongly suggests that alert is indeed not a DOM method.
    Last edited by Airblader; 10-10-2013 at 06:18 PM.

  8. #23
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,335
    Thanks
    11
    Thanked 588 Times in 569 Posts
    Quote Originally Posted by Airblader View Post
    In any case, at least being part of HTML5 strongly suggests that alert is indeed not a DOM method.
    it was around, un-spec'd, before HTML5 formalized it. it most certainly is a dom method, the link i posted contains the fragment "dom-alert", and that's in an address pointing to a W3 spec. it doesn't get much more official than that. mozilla refers to the HTML5 spec in its mdn page on alert().
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  9. #24
    Regular Coder
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    578
    Thanks
    4
    Thanked 77 Times in 77 Posts
    If it's not in the DOM spec, it is not a DOM method. And your link is the HTML5 spec, which is not DOM. The MDN talks about Gecko DOM, which is an implementation. If Mozilla sees it as part of their DOM, that's fine. That makes it part of their DOM's implementation, not part of the DOM. If I write my own spec and call something "dom-foobar", it still isn't part of the DOM either.

    So again: Unless the DOM spec itself says that alert is part of the DOM, it simply isn't, not per spec.

  10. #25
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,335
    Thanks
    11
    Thanked 588 Times in 569 Posts
    Quote Originally Posted by Airblader View Post
    If it's not in the DOM spec, it is not a DOM method. And your link is the HTML5 spec, which is not DOM. The MDN talks about Gecko DOM, which is an implementation. If Mozilla sees it as part of their DOM, that's fine. That makes it part of their DOM's implementation, not part of the DOM.

    If I write my own spec and call something "dom-foobar", it still isn't part of the DOM either.
    mozilla sees it as a part of the HTML5 implementation. the first link was an archived page not hosted on the mdn page shown to establish the undocumented nature of alert() prior to HTML5, the current copy of the page, linked secondly, refers to an html5 specification.

    i thought the debate was that alert() is not spec'd, which it clearly is. then it somehow got tied into the dom...

    i think the confusion here lies in a somewhat ambiguous usage of the term DOM. In one respect, we often mean the proper HTML DOM when we say DOM, stuff like getElementsByTagName, children[], nodeValue, etc.

    But, anything that in-browser JS reaches is considered part of the browser's DOM, including the "window" object spec'd as document.defaultView. This is why for example, xmlHttpRequest is spec'd using "DOMString"s instead of "String"s. If a browser wants to support HTML5, it MUST support alert().

    i agree that alert() is not part of the html document model, but that's not to say it's not part of the JS DOM, which encompasses more than just the document, stuff like ajax, addEventListener, registerPrototcolHandler and all that fun stuff.



    yes, it's confusing, but it also doesn't really matter one bit.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  11. #26
    Regular Coder
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    578
    Thanks
    4
    Thanked 77 Times in 77 Posts
    i thought the debate was that alert() is not spec'd, which it clearly is. then it somehow got tied into the dom...
    It was about whether it is a DOM method eversince the discussion started, I just pointed out that I failed to find it's specification in the DOM spec, which indicates that it is not part of the DOM.

    Yes, terms may be a little foggy here and I guess one could argue that it is part of "one" DOM, but not part of "another" DOM. Which would still lead me to say that "it is definitely part of the DOM" is simply wrong. It is part of some DOM "extensions", but there is only one Document Object Model specification, and that specification does not mention alert.

    but it also doesn't really matter one bit.
    Surely not to many developers who only use it. It probably matters more to those implementing the specs. Specs are a pain in the a** most of the time, but every now and then they are very useful. I experience it almost every day at work… For example, we have been developing a new feature for several weeks, establishing some new functionality in an existing interface by extending it with some new values. Suddenly the other party tells us that they meant to send us strings, not numbers. We are talking tens of thousands of dollars here for additional development to fix this, and luckily we had specs that clearly stated that we had agreed on numbers.

  12. #27
    New Coder
    Join Date
    Aug 2013
    Posts
    50
    Thanks
    0
    Thanked 11 Times in 11 Posts
    It's actually a part of the Browser Object Model, but my point was only that alert() isn't a part of the ECMAScript specification.

  13. #28
    Regular Coder
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    578
    Thanks
    4
    Thanked 77 Times in 77 Posts
    So it's part of the BOM, which is unspecified, not of the DOM, and we can finally settle that

    Quote Originally Posted by joesimmons View Post
    alert is a DOM method, just saying, lol. You may want to re-phrase that.
    is wrong and Philip was right all along when he said to use DOM methods instead, seeing how it was never your point anyway.

  14. Users who have thanked Airblader for this post:

    Philip M (10-11-2013)

  15. #29
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,990
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    Quote Originally Posted by rnd me View Post
    yes, it's confusing, but it also doesn't really matter one bit.
    Thank the Lord that a glimmer of common sense has appeared.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


 
Page 2 of 2 FirstFirst 12

LinkBacks (?)

  1. 03-18-2014, 11:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •