goog.dom.dataset
Functions
get( element, key ) → (string|null)
(string|null)
Gets a custom data attribute from an element. The key should be in camelCase format (e.g "keyName" for the "data-key-name" attribute).
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
getAll( element ) → Object
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']).
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
has( element, key ) → boolean
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).
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
remove( element, key ) → void
void
Removes a custom data attribute from an element. The key should be in camelCase format (e.g "keyName" for the "data-key-name" attribute).
Parameters |
|
---|
set( element, key, value ) → void
void
Sets a custom data attribute on an element. The key should be in camelCase format (e.g "keyName" for the "data-key-name" attribute).
Parameters |
|
---|