Skip to content

Commit

Permalink
Merge pull request #1 from cqse/dataset_deprecation
Browse files Browse the repository at this point in the history
Deprecated dataset methods
  • Loading branch information
DreierF authored Sep 30, 2020
2 parents edcec22 + 0137df2 commit e4e4e22
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions closure/goog/dom/dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ goog.dom.dataset.isValidProperty_ = function(key) {
/**
* Sets a custom data attribute on an element. The key should be
* in camelCase format (e.g "keyName" for the "data-key-name" attribute).
*
* @deprecated use <code>element.dataset.yourKeyHere = yourValue</code> instead
*
* @param {Element} element DOM node to set the custom data attribute on.
* @param {string} key Key for the custom data attribute.
* @param {string} value Value for the custom data attribute.
Expand All @@ -89,6 +92,9 @@ goog.dom.dataset.set = function(element, key, value) {
/**
* Gets a custom data attribute from an element. The key should be
* in camelCase format (e.g "keyName" for the "data-key-name" attribute).
*
* @deprecated use <code>element.dataset.yourKeyHere<code> directly
*
* @param {Element} element DOM node to get the custom data attribute from.
* @param {string} key Key for the custom data attribute.
* @return {?string} The attribute value, if it exists.
Expand Down Expand Up @@ -118,7 +124,10 @@ goog.dom.dataset.get = function(element, key) {

/**
* Removes a custom data attribute from an element. The key should be
* in camelCase format (e.g "keyName" for the "data-key-name" attribute).
* in camelCase format (e.g "keyName" for the "data-key-name" attribute).
*
* @deprecated use <code>delete element.dataset.yourKeyHere</code> instead
*
* @param {Element} element DOM node to get the custom data attribute from.
* @param {string} key Key for the custom data attribute.
*/
Expand Down Expand Up @@ -146,6 +155,8 @@ goog.dom.dataset.remove = function(element, key) {
* 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).
*
* @deprecated check for the existance of <code>element.dataset.yourKey</code> instead
*
* @param {Element} element DOM node to get the custom data attribute from.
* @param {string} key Key for the custom data attribute.
* @return {boolean} Whether the attribute exists.
Expand Down Expand Up @@ -174,8 +185,11 @@ goog.dom.dataset.has = function(element, key) {
* 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']).
*
* @deprecated use <code>element.dataset</code> instead, which returns a <code>DOMStringMap</code>
*
* @param {!Element} element DOM node to get the data attributes from.
* @return {!Object} The string map containing data attributes and their
* @return {!Object<string, string?>} The string map containing data attributes and their
* respective values.
*/
goog.dom.dataset.getAll = function(element) {
Expand Down

0 comments on commit e4e4e22

Please sign in to comment.