Enjoy an ad free experience by logging in. Not a member yet? Register.
|
Results 1 to 11 of 11
-
02-24-2014, 07:15 PM #1
- 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
-
02-24-2014, 08:01 PM #2
- Join Date
- Jun 2002
- Location
- London, England
- Posts
- 19,232
- Thanks
- 211
- Thanked 2,669 Times in 2,645 Posts
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.
-
02-24-2014, 09:49 PM #3
- Join Date
- Sep 2005
- Location
- Sydney, Australia
- Posts
- 9,249
- Thanks
- 4
- Thanked 932 Times in 919 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.
-
02-25-2014, 04:28 AM #4
- Join Date
- Jun 2007
- Location
- Urbana
- Posts
- 4,650
- Thanks
- 11
- Thanked 626 Times in 605 Posts
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.
Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com
-
02-25-2014, 08:35 AM #5
- Join Date
- Jun 2002
- Location
- London, England
- Posts
- 19,232
- Thanks
- 211
- Thanked 2,669 Times in 2,645 Posts
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."
-
02-25-2014, 09:18 AM #6
- Join Date
- Jun 2007
- Location
- Urbana
- Posts
- 4,650
- Thanks
- 11
- Thanked 626 Times in 605 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."...
Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com
-
02-25-2014, 09:19 AM #7
- Join Date
- Jun 2007
- Location
- Urbana
- Posts
- 4,650
- Thanks
- 11
- Thanked 626 Times in 605 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?Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com
-
02-25-2014, 09:52 AM #8
- Join Date
- Jun 2002
- Location
- London, England
- Posts
- 19,232
- Thanks
- 211
- Thanked 2,669 Times in 2,645 Posts
"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.
-
02-25-2014, 05:25 PM #9
- Join Date
- Jun 2007
- Location
- Urbana
- Posts
- 4,650
- Thanks
- 11
- Thanked 626 Times in 605 Posts
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.
Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com
-
02-27-2014, 10:32 AM #10
- Join Date
- Mar 2006
- Location
- Splendora, Texas, United States of America
- Posts
- 3,601
- Thanks
- 40
- Thanked 312 Times in 306 Posts
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.
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); }
char
property found in the last W3C Working Draft while thecode
property, added in the most recent Working Draft, is supported by no one.
Thekey
property is partially supported in both Firefox and IE. Firefox returns the proprietary valuemozPrintableKey
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 theDOMTokenList
interface:
Code:document.documentElement.classList.add("red", "green", "blue"); alert(document.documentElement.classList); // Should output "red green blue".
Attribute
nodes; nodes types such asEntity
,EntityReference
, andNotation
were never implemented; and features likerenameNode
(that I still think could be useful) never got traction.
-
02-27-2014, 07:13 PM #11
- Join Date
- Jun 2007
- Location
- Urbana
- Posts
- 4,650
- Thanks
- 11
- Thanked 626 Times in 605 Posts
informative. more than you ever needed to know about the DOM. good work!