dataset.js
No description.

File Location

/goog/dom/dataset.js


Public Protected Private

Global Functions

goog.dom.dataset.get(elementkey) ?string
Gets a custom data attribute from an element. The key should be in camelCase format (e.g "keyName" for the "data-key-name" attribute).
Arguments:
element : Element
DOM node to get the custom data attribute from.
key : string
Key for the custom data attribute.
Returns: ?string  The attribute value, if it exists.
code »
goog.dom.dataset.getAll(element) !Object
Gets all custom data attributes as a string map. The attribute names will be camel cased (e.g., data-foo-bar -> dataset['fooBar']). This operation is not safe for attributes having camel-cased names clashing with already existing properties (e.g., data-to-string -> dataset['toString']).
Arguments:
element : !Element
DOM node to get the data attributes from.
Returns: !Object  The string map containing data attributes and their respective values.
code »
goog.dom.dataset.has(elementkey) boolean
Checks whether custom data attribute exists on an element. The key should be in camelCase format (e.g "keyName" for the "data-key-name" attribute).
Arguments:
element : Element
DOM node to get the custom data attribute from.
key : string
Key for the custom data attribute.
Returns: boolean  Whether the attribute exists.
code »
goog.dom.dataset.remove(elementkey)
Removes a custom data attribute from an element. The key should be in camelCase format (e.g "keyName" for the "data-key-name" attribute).
Arguments:
element : Element
DOM node to get the custom data attribute from.
key : string
Key for the custom data attribute.
code »
goog.dom.dataset.set(elementkeyvalue)
Sets a custom data attribute on an element. The key should be in camelCase format (e.g "keyName" for the "data-key-name" attribute).
Arguments:
element : Element
DOM node to set the custom data attribute on.
key : string
Key for the custom data attribute.
value : string
Value for the custom data attribute.
code »

Directory dom

File Reference