DOM

DOM

Source

Element/toggleAttribute

In all current engines.

Firefox63+Safari12+Chrome69+ Opera56+Edge79+ Edge (Legacy)18IENone Firefox for Android63+iOS SafariYesChrome for Android69+Android WebView69+Samsung Internet10.0+Opera Mobile48+

The toggleAttribute(qualifiedName, force) method steps are:

  1. If qualifiedName does not match the Name production in XML, then throw an "InvalidCharacterError" DOMException.

  2. If this is in the HTML namespace and its node document is an HTML document, then set qualifiedName to qualifiedName in ASCII lowercase.

  3. Let attribute be the first attribute in this’s attribute list whose qualified name is qualifiedName, and null otherwise.

  4. If attribute is null, then:

  5. Otherwise, if force is not given or is false, remove an attribute given qualifiedName and this, and then return false.

  6. Return true.

Element/hasAttributeNS

In all current engines.

Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+

The hasAttributeNS(namespace, localName) method steps are:

Element/getAttributeNode

In all current engines.

Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+

The getAttributeNode(qualifiedName) method
steps are to return the result of getting an attribute given qualifiedName and this.

Element/getAttributeNodeNS

In all current engines.

Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+

The getAttributeNodeNS(namespace, localName) method steps are to return the result of getting an attribute given namespace, localName, and this.

Element/setAttributeNode

In all current engines.

Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+

Element/setAttributeNodeNS

In all current engines.

Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+

The setAttributeNode(attr) and setAttributeNodeNS(attr) methods steps are to
return the result of setting an attribute given attr and this.

Element/removeAttributeNode

In all current engines.

Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+

The method steps
are:

var shadow = element . attachShadow(init)

Creates a shadow root for element and returns it.

var shadow = element . shadowRoot

Returns element’s shadow root, if any, and if shadow root’s mode is "open", and null otherwise.

Element/attachShadow

In all current engines.

Firefox63+Safari10+Chrome53+ Opera40+Edge79+ Edge (Legacy)NoneIENone Firefox for Android63+iOS Safari10+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+

The attachShadow(init) method steps are:

  1. If this’s namespace is not the HTML namespace, then throw a "NotSupportedError" DOMException.

  2. If this’s local name is not one of the following:

    • a valid custom element name
    • "article", "aside", "blockquote", "body", "div", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "header", "main", "nav", "p", "section", or "span"

    then throw a "NotSupportedError" DOMException.

  3. If this’s local name is a valid custom element name, or this’s is value is not null, then:

  4. If this is a shadow host, then throw an "NotSupportedError" DOMException.

  5. Let shadow be a new shadow root whose node document is this’s node document, host is this, and mode is init["mode"].

  6. Set shadow’s delegates focus to init["delegatesFocus"].

  7. If this’s custom element state is "precustomized" or "custom", then set shadow’s available to element internals to true.

  8. Set shadow’s slot assignment to init["slotAssignment"].

  9. Set this’s shadow root to shadow.

  10. Return shadow.

Element/shadowRoot

In all current engines.

Firefox63+Safari10+Chrome35+ Opera22+Edge79+ Edge (Legacy)NoneIENone Firefox for Android63+iOS Safari10+Chrome for Android35+Android WebView37+Samsung Internet3.0+Opera Mobile22+

The shadowRoot getter steps are:

  1. Let shadow be this’s shadow root.

  2. If shadow is null or its mode is "closed", then return null.

  3. Return shadow.

element . closest(selectors) Returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise. element . matches(selectors) Returns true if matching selectors against element’s root yields element; otherwise false.

Element/closest

In all current engines.

Firefox35+Safari6+Chrome41+ Opera28+Edge79+ Edge (Legacy)15+IENone Firefox for Android35+iOS Safari9+Chrome for Android41+Android WebView41+Samsung Internet4.0+Opera Mobile28+

The closest(selectors) method steps are:

Element/matches

In all current engines.

Firefox34+Safari7+Chrome33+ Opera21+Edge79+ Edge (Legacy)15+IENone Firefox for Android34+iOS Safari8+Chrome for Android33+Android WebView4.4+Samsung Internet2.0+Opera Mobile21+

The matches(selectors) and webkitMatchesSelector(selectors) method steps
are:

Report Page