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.
Results 1 to 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What is the difference between DOM lvl 0, 2 and 3 Events?

    Hello everyone,

    I am new with Javascript and i learned about using events today. only 1 thing isn't very clear to me.
    I red about Dom level 0, 2, and 3 events, and i dont really understand what the difference is between those.
    Could someone maybe clear things up abit about those different levels of events? (and maybe some Pro's/Con's for each of them?)

    I will be very grateful

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,310
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Quote Originally Posted by FearReaper View Post
    Hello everyone,

    I am new with Javascript and i learned about using events today. only 1 thing isn't very clear to me.
    I red about Dom level 0, 2, and 3 events, and i dont really understand what the difference is between those.
    Could someone maybe clear things up abit about those different levels of events? (and maybe some Pro's/Con's for each of them?)

    I will be very grateful
    Have a look at DOM events - Wikipedia, the free encyclopedia

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    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.

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    DOM 0 is proprietary commands that were built into browsers before the standard DOM was defined. They have all been superseded by the standard DOM but still work in browsers simply for backward support with scripts written for early Netscape browsers.

    DOM 1, 2, and 3 are the three different stages in which the standard DOM commands were released. The only difference between them is that there may be a few people still using older browsers that had not yet implemented all of the new conmmands from the DOM 3 standard and so if you use those commands they will not work for that small group of visitors.

    All current browsers support the full DOM standard (and there are no plans for developing a DOM 4 standard as everything imaginable was included in DOM 3).
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    Quote Originally Posted by felgall View Post
    All current browsers support the full DOM standard (and there are no plans for developing a DOM 4 standard as everything imaginable was included in DOM 3).
    DOM4 is being finished as we speak, out a few weeks from now : W3C DOM4 ... Better hurry or hold your peace until DOM5...

    it removes a lot of the crap from the previous specs and adds a few new clean interfaces, but it's mostly the same as DOM3...
    Last edited by rnd me; 02-25-2014 at 04:40 AM.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,310
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Quote Originally Posted by rnd me View Post
    DOM4 is being finished as we speak, out a few weeks from now : W3C DOM4 ... Better hurry or hold your peace until DOM5...
    Hardly.

    "Publication as a Last Call Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress."

  • #6
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    until march 4th, and already "This is a Last Call Working Draft and thus the Working Group has determined that this document has satisfied the relevant technical requirements and is sufficiently stable to advance through the Technical Recommendation process."...
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #7
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    until march 4th, and already "This is a Last Call Working Draft and thus the Working Group has determined that this document has satisfied the relevant technical requirements and is sufficiently stable to advance through the Technical Recommendation process."...

    and besides, how does that negate what i said in my post?
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #8
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,310
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Quote Originally Posted by rnd me View Post
    until march 4th, and already "This is a Last Call Working Draft and thus the Working Group has determined that this document has satisfied the relevant technical requirements and is sufficiently stable to advance through the Technical Recommendation process."...

    and besides, how does that negate what i said in my post?
    "and is sufficiently stable to advance through the Technical Recommendation process." suggests to me that it is a long way from final approval by whoever gives final approval, and in any case it will be years before it filters through into browsers. And as you say, it is mostly the same as DOM3.

    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.

  • #9
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    Quote Originally Posted by Philip M View Post
    "and is sufficiently stable to advance through the Technical Recommendation process." suggests to me that it is a long way from final approval by whoever gives final approval, and in any case it will be years before it filters through into browsers. And as you say, it is mostly the same as DOM3.
    If by years you mean the new stuff is already in current versions of all major browsers, then i agree. Standardizing the Observers is probably the juiciest nugget of the new spec. see http://caniuse.com/mutationobserver... While you were sleeping, Chrome and firefox have also already removed, ex, setUserData and many (all?) of the other Jurassic-period node methods DOM4 obsoletes. Thus, it shouldn't take long for the CFI state since several are basically ready-to-go.

    I don't see why you're so dismissive; W3 puts the exact same warning text on html5. If you argument was that the W3's descriptions are subject to confusing laymen interpretation, i'd agree, but as a dev you should know what they mean by now. If you wait until stuff reaches xhtml1.0-level maturity, you're going to be years behind the competition. I doubt many users care about the official maturity of the <video> tag spec, but they do care that your videos won't play on their ipad when other sites seem to handle video just fine...
    Last edited by rnd me; 02-25-2014 at 05:56 PM.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #10
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,387
    Thanks
    32
    Thanked 288 Times in 282 Posts
    Quote Originally Posted by FearReaper View Post
    I am new with Javascript and i learned about using events today. only 1 thing isn't very clear to me.
    I red about Dom level 0, 2, and 3 events, and i dont really understand what the difference is between those.
    Could someone maybe clear things up abit about those different levels of events?
    DOM specs used to be defined in terms of conformance levels where a higher level contained more advanced features that built on features of a previous level. For example, if level 3 was supported, you (in theory) could assume that level 2 was supported. Each level had a "Core" spec; non-Core specs on the relevant level assumed that the Core spec for that level was fully supported.

    For modern purposes, levels are an anachronism. The only relevant DOM spec still using a level designation is DOM3 Events. DOM4 exists (following DOM3 Core), but doesn't use the term "level". Since the W3C doesn't do "living standards", but instead publishes static standards, they maintain the archaic leveling system in name only.

    Leveled DOM standards you may see include:
    • DOM(1) Core, DOM2 Core, and DOM3 Core. These have been abandoned in favor of the WHATWG DOM Living Standard and W3C DOM4.
    • DOM(1) HTML and DOM2 HTML. These have been abandoned in favor of the WHAT HTML Living Standard and W3C HTML5, 5.1, and other W3C HTML spin-off specs.
    • DOM2 Style and DOM2 Views which are now two CSS specs: CSSOM and CSSOM View Module.
    • DOM3 Events. Still a leveled spec, but parts of this have been merged into other specs such as DOM LS and DOM4 and HTML LS and HTML5.
    • DOM2 Traversal and Range. This spec was merged into DOM LS and DOM4.
    • DOM3 Validation. This spec was never implemented in any browser and is essentially dead.
    • Selectors API 1 and 2. The level 2 spec was dropped before completion and merged into DOM LS and DOM4 specs.

    CSS also uses leveled specs and the same thing applies; levels are now basically stand-ins for module version numbers. For example, the CSS Exclusions Module starts at level 1 instead of 3 as would have been the case with the original leveled system.

    Quote Originally Posted by felgall View Post
    The only difference between them is that there may be a few people still using older browsers that had not yet implemented all of the new conmmands from the DOM 3 standard and so if you use those commands they will not work for that small group of visitors.

    All current browsers support the full DOM standard (and there are no plans for developing a DOM 4 standard as everything imaginable was included in DOM 3).
    DOM3 Events is not completely supported by anyone yet. The spec changed significantly when a relatively recent decision was made to do a major rewrite of the keyboard events section. (Keyboard events are quite complicated since the spec editors are forced to consider input from non-Western keyboards, IMEs, and keyboards that add utility keys for functions like volume muting or showing the Calculator app in Windows.) For example, try this code:

    Code:
    function doSomething(keyUpEvent) {
    	alert("keyUpEvent.char: " + keyUpEvent.char + "\nkeyUpEvent.key: " + keyUpEvent.key + "\nkeyUpEvent.code: " + keyUpEvent.code);
    }
    Only IE supports the char property found in the last W3C Working Draft while the code property, added in the most recent Working Draft, is supported by no one.

    The key property is partially supported in both Firefox and IE. Firefox returns the proprietary value mozPrintableKey for printable keys (instead of outputting the key value as required by the previous and current Working Drafts) while both of them support value lists based on older drafts for non-printable keys. Try the "LaunchCalculator" key and you'll get the now-undefined "LaunchApplication2" value from the 2012 draft, for example.

    As for DOM LS and DOM4, that's still not supported by everyone either. For example, IE11 doesn't fully support the DOMTokenList interface:

    Code:
    document.documentElement.classList.add("red", "green", "blue");
    alert(document.documentElement.classList); // Should output "red green blue".
    DOM3 Core isn't supported by anyone either since everyone removed support for Attribute nodes; nodes types such as Entity, EntityReference, and Notation were never implemented; and features like renameNode (that I still think could be useful) never got traction.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #11
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    informative. more than you ever needed to know about the DOM. good work!


  •  

    LinkBacks (?)

    1. 02-25-2014, 12:03 PM

    Tags for this Thread

    Posting Permissions

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