isSupported (W3C DOM Core method)

Spec
Version Depr. Static
DOM2 No No
Browser support (more…)
IE7 FF1.5+ SA1.3+ OP9+
None Full Full Full
Returns
Boolean

Example

var supported = node.isSupported('Events', '2.0')

In the example above, the variable supported will have the value true if the implementation includes the DOM 2 Events module and it's supported by this node. Otherwise supported will have the value false.

Arguments

feature (DOMString) required

The name of the feature to test, using one of the values defined in the DOM 2 Conformance list.

version (DOMString)

The DOM version to test. For DOM 2 this is always the value 2.0. If this argument is not specified, the method will return true if the feature is supported at any DOM level.

Description

Test whether a specific feature of the DOM is implemented, and supported by this node.

This method is essentially the same as hasFeature, except that it's concerned with whether a feature is supported by a specific node, rather than whether it's implemented in general.

Here's a list of the features and DOM versions that can be tested:

Table 1. DOM features and versions that can be tested with hasFeature
Feature name Version Description
XML 1.0 DOM 1 Core and XML
HTML 1.0 DOM 1 Core and HTML
Core 2.0 DOM 2 Core
XML 2.0 DOM 2 XML
HTML 2.0 DOM 2 HTML
Views 2.0 DOM 2 Views module
StyleSheets 2.0 DOM 2 Style Sheets module
CSS 2.0 DOM 2 CSS module
CSS2 2.0 DOM 2 CSS 2 module
Events 2.0 DOM 2 Events module
UIEvents 2.0 DOM 2 User-interface Events module
MutationEvents 2.0 DOM 2 Mutation Events module
HTMLEvents 2.0 DOM 2 HTML Events module
Range 2.0 DOM 2 Range module
Traversal 2.0 DOM 2 Traversal module
Tip: This method is just a useless as hasFeature

As with hasFeature, the practical usefulness of this method is negligible (see hasFeature for details).

Return value

Returns true if the feature is implemented and supported on this node, otherwise false

Compatibility

Internet Explorer Firefox Safari Opera
5.5 6.0 7.0 1.5 2.0 3.0 1.3 2.0 3.0 9.0 9.5
None None None Full Full Full Full Full Full Full Full

Internet Explorer doesn't implement this method, and will throw an error if it's used.

User-contributed notes

There are no comments yet.

Related Products