hasFeature: feature, version
Tests to see if the DOM implementation supports a specific version of a named feature package.
The package name of the feature to test. The following feature names (and others listed at http://www.w3.org/TR/DOM-Level-2-Core/introduction.html-ID-Conformance) are valid:
Supports DOM Level 1.0 or 2.0 Core objects.
Supports DOM Level 1.0 or 2.0 HTML objects.
Represents the DOM version level of the specified
feature to test. If no version number is specified, the
function returns true
if
any version is supported.
Returns true
if the
particular version of the specified feature is available;
otherwise, it returns false
.
// Make sure that DOM Level 1 XML is supported if (!di.hasFeature("XML", "1.0")) { return null; }
The HTML-specific DOM objects are beyond the scope of this book, but they are extremely useful tools for building applications that perform transformations on HTML documents. An excellent reference to the HTML DOM objects can be found in the book Dynamic HTML: The Definitive Reference, by Danny Goodman (O'Reilly).