DOM
SourceIn 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+
In all current engines.
Firefox63+Safari10+Chrome53+ Opera40+Edge79+ Edge (Legacy)NoneIE? Firefox for Android63+iOS Safari10+Chrome for Android53+Android WebView53+Samsung Internet6.0+Opera Mobile41+
The slot
attribute must reflect the
"slot
" content attribute.
id
, class
, and slot
are effectively
superglobal attributes as they can appear on any element, regardless of that element’s
namespace.
element . hasAttributes()
Returns true if element has attributes; otherwise false.
element . getAttributeNames()
Returns the qualified names of all element’s attributes. Can contain duplicates.
element . getAttribute(qualifiedName)
Returns element’s first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise.
element . getAttributeNS(namespace, localName)
Returns element’s attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise.
element . setAttribute(qualifiedName, value)
Sets the value of element’s first attribute whose qualified name is qualifiedName to value.
element . setAttributeNS(namespace, localName, value)
Sets the value of element’s attribute whose namespace is namespace and local name is localName to value.
element . removeAttribute(qualifiedName)
Removes element’s first attribute whose qualified name is qualifiedName.
element . removeAttributeNS(namespace, localName)
Removes element’s attribute whose namespace is namespace and local name is localName.
element . toggleAttribute(qualifiedName [, force])
If force is not given, "toggles" qualifiedName, removing it if it is present and adding it if it is not present. If force is true, adds qualifiedName. If force is false, removes qualifiedName.
Returns true if qualifiedName is now present; otherwise false.
element . hasAttribute(qualifiedName)
Returns true if element has an attribute whose qualified name is qualifiedName; otherwise false.
element . hasAttributeNS(namespace, localName)
Returns true if element has an attribute whose namespace is namespace and local name is localName.
In all current engines.
Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE8+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile12.1+
The hasAttributes()
method steps are to return false
if this’s attribute list is empty; otherwise true.
In all current engines.
Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5.5+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+
The attributes
getter steps are to return the
associated NamedNodeMap
.
In all current engines.
Firefox45+Safari10.1+Chrome61+ Opera48+Edge79+ Edge (Legacy)18IENone Firefox for Android45+iOS Safari10.3+Chrome for Android61+Android WebView61+Samsung Internet8.0+Opera Mobile45+
The getAttributeNames()
method steps are to return the qualified names of the attributes in this’s attribute list, in order; otherwise a new list.
These are not guaranteed to be unique.
In all current engines.
Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+
The getAttribute(qualifiedName)
method
steps are:
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 getAttributeNS(namespace, localName)
method steps are:
In all current engines.
Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+
The setAttribute(qualifiedName, value)
method steps are:
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 setAttributeNS(namespace, qualifiedName, value)
method steps are:
In all current engines.
Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+
The method steps are to remove an attribute given qualifiedName and this, and then return undefined.
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 method steps are to remove an attribute given namespace, localName, and this, and then return undefined.
In all current engines.
Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE8+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+
The hasAttribute(qualifiedName)
method
steps are:
Read Next page