DOM
SourceYes, the name DOMTokenList
is an unfortunate legacy mishap.
In all current engines.
Firefox3.6+Safari5.1+Chrome8+ Opera11.5+Edge79+ Edge (Legacy)12+IE10+ Firefox for Android4+iOS Safari5.1+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera Mobile11.5+
In all current engines.
Firefox50+Safari10.1+Chrome42+ Opera32+Edge79+ Edge (Legacy)16+IENone Firefox for Android50+iOS Safari10.3+Chrome for Android45+Android WebView45+Samsung Internet5.0+Opera Mobile32+
In all current engines.
Firefox50+Safari10.1+Chrome42+ Opera32+Edge79+ Edge (Legacy)16+IENone Firefox for Android50+iOS Safari10.3+Chrome for Android45+Android WebView45+Samsung Internet5.0+Opera Mobile32+
In all current engines.
Firefox50+Safari10.1+Chrome42+ Opera32+Edge79+ Edge (Legacy)16+IENone Firefox for Android50+iOS Safari10.3+Chrome for Android45+Android WebView45+Samsung Internet5.0+Opera Mobile32+
In all current engines.
Firefox50+Safari10.1+Chrome42+ Opera32+Edge79+ Edge (Legacy)16+IENone Firefox for Android50+iOS Safari10.3+Chrome for Android45+Android WebView45+Samsung Internet5.0+Opera Mobile32+
[Exposed=Window]
interface DOMTokenList
{ readonly attribute ); ); [); [, optional ); [, ); ); [ attribute DOMString value; iterable<DOMString>;
};
A DOMTokenList
object has an associated token set (a set), which is
initially empty.
A DOMTokenList
object also has an associated element and an attribute’s local name.
Specifications may define supported tokens for a DOMTokenList
's
associated attribute’s local name.
A DOMTokenList
object’s validation steps for a given token are:
A DOMTokenList
object’s update steps are:
A DOMTokenList
object’s serialize steps are to return the result of running get an attribute value given the associated element and the associated attribute’s local name.
A DOMTokenList
object has these attribute change steps for its associated element:
When a DOMTokenList
object is created, then:
tokenlist . length
Returns the number of tokens.
tokenlist . item(index)
tokenlist[index]
Returns the token with index index.
tokenlist . contains(token)
Returns true if token is present; otherwise false.
tokenlist . add(tokens…)
Adds all arguments passed, except those already present.
Throws a "SyntaxError
" DOMException
if one of the arguments is the empty string.
Throws an "InvalidCharacterError
" DOMException
if one of the arguments contains any ASCII whitespace.
tokenlist . remove(tokens…)
Removes arguments passed, if they are present.
Throws a "SyntaxError
" DOMException
if one of the arguments is the empty string.
Throws an "InvalidCharacterError
" DOMException
if one of the arguments contains any ASCII whitespace.
tokenlist . toggle(token [, force])
If force is not given, "toggles" token, removing it if it’s present and adding it if it’s not present. If force is true, adds token (same as add()
). If force is false, removes token (same as remove()
).
Returns true if token is now present; otherwise false.
Throws a "SyntaxError
" DOMException
if token is empty.
Throws an "InvalidCharacterError
" DOMException
if token contains any spaces.
tokenlist . replace(token, newToken)
Replaces token with newToken.
Returns true if token was replaced with newToken; otherwise false.
Throws a "SyntaxError
" DOMException
if one of the arguments is the empty string.
Throws an "InvalidCharacterError
" DOMException
if one of the arguments contains any ASCII whitespace.
tokenlist . supports(token)
Returns true if token is in the associated attribute’s supported tokens. Returns false otherwise.
Throws a TypeError
if the associated attribute has no supported tokens defined.
tokenlist . value
Returns the associated set as string.
Can be set, to change the associated attribute.
In all current engines.
Firefox50+Safari5.1+Chrome8+ OperaYesEdge79+ Edge (Legacy)12+IE10+ Firefox for Android50+iOS Safari5.1+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes
The length
attribute' getter must return this’s token set’s size.
The object’s supported property indices are the numbers in the range zero to object’s token set’s size minus one, unless token set is empty,
in which case there are no supported property indices.
In all current engines.
Firefox3.6+Safari5.1+Chrome8+ OperaYesEdge79+ Edge (Legacy)12+IE10+ Firefox for Android4+iOS Safari5.1+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes
The item(index)
method steps are:
In all current engines.
Firefox3.6+Safari5.1+Chrome8+ OperaYesEdge79+ Edge (Legacy)12+IE10+ Firefox for Android4+iOS Safari5.1+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes
The contains(token)
method steps are
to return true if this’s token set[token] exists; otherwise
false.
In all current engines.
Firefox3.6+Safari5.1+Chrome8+ OperaYesEdge79+ Edge (Legacy)12+IE10+ Firefox for Android4+iOS Safari5.1+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes
The add(tokens…)
method steps are:
In all current engines.
Firefox3.6+Safari5.1+Chrome8+ OperaYesEdge79+ Edge (Legacy)12+IE10+ Firefox for Android4+iOS Safari5.1+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes
The method steps are:
In all current engines.
Firefox3.6+Safari5.1+Chrome8+ OperaYesEdge79+ Edge (Legacy)12+IE10+ Firefox for Android4+iOS Safari5.1+Chrome for Android18+Android WebView3+Samsung Internet1.0+Opera MobileYes
The toggle(token, force)
method steps are:
The update steps are not always run for toggle()
for web compatibility.
In all current engines.
Firefox49+Safari10.1+Chrome61+ Opera48+Edge79+ Edge (Legacy)17+IENone Firefox for Android49+iOS Safari10.3+Chrome for Android61+Android WebView61+Samsung Internet8.0+Opera Mobile45+
The replace(token, newToken)
method steps are:
The update steps are not always run for replace()
for web compatibility.
The supports(token)
method steps are:
-
Let result be the return value of validation steps called with token.
-
Return result.
In all current engines.
Firefox47+Safari10+Chrome50+ Opera37+Edge79+ Edge (Legacy)17+IENone Firefox for Android47+iOS Safari10+Chrome for Android50+Android WebView50+Samsung Internet5.0+Opera Mobile37+
The value
attribute must return the
result of running this’s serialize steps.
Setting the value
attribute must set an attribute value for the
associated element using associated attribute’s local name and
the given value.
DOM Level 3 XPath defined an API for evaluating XPath 1.0 expressions. These APIs are widely implemented, but have not been maintained. The interface
definitions are maintained here so that they can be updated when Web IDL changes.
Complete definitions of these APIs remain necessary and such work is tracked and can be contributed
to in whatwg/dom#67. [DOM-Level-3-XPath] [XPath] [WEBIDL]
[Exposed=Window]
interface XPathResult
{ const = 0; const = 1; const = 2; const = 3; const = 4; const = 5; const = 6; const = 7; const = 8; const = 9; readonly attribute ; readonly attribute ; readonly attribute ; readonly attribute ; readonly attribute ; readonly attribute ; readonly attribute ; (); ();
};
[Exposed=Window]
interface XPathExpression
{ // XPathResult.ANY_TYPE = 0 (, optional = 0, optional = null);
};
callback interfaceXPathNSResolver
{ (); }; interface mixinXPathEvaluatorBase
{ [(, optional = null); (); // XPathResult.ANY_TYPE = 0 (, , optional = null, optional = 0, optional = null); }; Document includes XPathEvaluatorBase;
[Exposed=Window] interfaceXPathEvaluator
{constructor
(); }; XPathEvaluator includes XPathEvaluatorBase;
For historical reasons you can both construct XPathEvaluator
and access the same
methods on Document
.
XSL Transformations (XSLT) is a language for transforming XML documents
into other XML documents. The APIs defined in this section have been widely implemented, and are
maintained here so that they can be updated when Web IDL changes. Complete definitions
of these APIs remain necessary and such work is tracked and can be contributed to in whatwg/dom#181. [XSLT]
[Exposed=Window] interfaceXSLTProcessor
{constructor
(); (); [(, ); [(); ([, , ); ([, ); (); (); };
This standard used to contain several interfaces and interface members that have been removed.
These interfaces have been removed:
DOMConfiguration
DOMError
DOMErrorHandler
DOMImplementationList
DOMImplementationSource
DOMLocator
DOMObject
DOMUserData
Entity
EntityReference
MutationEvent
MutationNameEvent
NameList
Notation
RangeException
TypeInfo
UserDataHandler
And these interface members have been removed: