Used by the dataset HTML 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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
DOMStringMapChrome Full support YesEdge Full support YesFirefox Full support 6IE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

See also

Document Tags and Contributors

Last updated by: wbamberg,