Used by the HTMLElement.dataset
attribute to represent data for custom attributes added to elements.
Method overview
DOMString getDataAttr(in DOMString prop); |
boolean hasDataAttr(in DOMString prop); |
void removeDataAttr(in DOMString prop); |
void removeProp(in nsIAtom attr); |
void setDataAttr(in DOMString prop, in DOMString value); |
Methods
hasDataAttr()
boolean hasDataAttr( in DOMString prop );
Parameters
prop
- The property for which to check for the existence of a value.
Return value
true
if the property exists; otherwise false
.
removeDataAttr()
void removeDataAttr( in DOMString prop );
Parameters
prop
- The property to remove from the data set.
removeProp()
Removes the property from the dataset object. Used to update the dataset object when data-* attribute has been removed from the element.
void removeProp( in nsIAtom attr );
Parameters
attr
- The property to remove from the dataset.
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
DOMStringMap | Chrome Full support Yes | Edge Full support Yes | Firefox Full support 6 | IE ? | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support Yes | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android ? |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown