Main Page

DOM Support

The W3C has also published language-specific DOMs defined for SVG (
), SMIL Animation (
), and MathML (
DOM Support
As I said previously, not all browsers are at the same level of DOM support. Generally speaking, Mozilla
has the best DOM standards support, supporting almost all DOM Level 2 and parts of DOM Level 3.
Behind Mozilla, Opera and Safari have made significant inroads toward closing the support gap, sup-
porting almost all DOM Level 1 and most of DOM Level 2. Lagging behind the field is Internet Explorer,
whose incomplete implementation of DOM Level 1 leaves much to be desired.
Using the DOM
Even though the
object is considered part of the BOM, it is also is a representation of the HTML
object, which, in turn, is also an XML DOM
object. Most DOM manipu-
lation in JavaScript makes use of the
object, so that’s a logical place to begin the discussion.
Accessing relative nodes
Consider the following HTML page for the next few sections:
<title>DOM Example</title>
<p>Hello World!</p>
<p>Isn’t this exciting?</p>
<p>You’re learning to use the DOM!</p>
To access the
element (which you should realize is the
element of this file), you can
use the
property of
var oHtml = document.documentElement;
Because of an incorrect DOM implementation, Internet Explorer 5.5 returns the
element for
. Internet Explorer 6.0 fixes
this problem.
DOM Basics
09_579088 ch06.qxd 3/28/05 11:37 AM Page 167

JavaScript EditorFree JavaScript Editor     Ajax Editor