From 0137df2512699c108ca8980e3bbca8761bdc5416 Mon Sep 17 00:00:00 2001 From: Daniel Veihelmann Date: Wed, 30 Sep 2020 09:35:16 +0200 Subject: [PATCH] Deprecated dataset methods --- closure/goog/dom/dataset.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/closure/goog/dom/dataset.js b/closure/goog/dom/dataset.js index fd28c5c763..11889d12c6 100644 --- a/closure/goog/dom/dataset.js +++ b/closure/goog/dom/dataset.js @@ -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 element.dataset.yourKeyHere = yourValue 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. @@ -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 element.dataset.yourKeyHere 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. @@ -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 delete element.dataset.yourKeyHere instead + * * @param {Element} element DOM node to get the custom data attribute from. * @param {string} key Key for the custom data attribute. */ @@ -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 element.dataset.yourKey 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. @@ -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 element.dataset instead, which returns a DOMStringMap + * * @param {!Element} element DOM node to get the data attributes from. - * @return {!Object} The string map containing data attributes and their + * @return {!Object} The string map containing data attributes and their * respective values. */ goog.dom.dataset.getAll = function(element) {