From 205c6d022332bcb2e36470d96ec1381207fa3696 Mon Sep 17 00:00:00 2001 From: tonypine Date: Tue, 1 Mar 2016 11:26:35 -0300 Subject: [PATCH] Use only getAttribute and setAttribute to maximize browser compatibility, due to partial support of the .dataset method --- src/js/plugin/instances.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/js/plugin/instances.js b/src/js/plugin/instances.js index 9c233c0..d4d74f3 100644 --- a/src/js/plugin/instances.js +++ b/src/js/plugin/instances.js @@ -79,27 +79,15 @@ function Instance(element) { } function getId(element) { - if (typeof element.dataset === 'undefined') { - return element.getAttribute('data-ps-id'); - } else { - return element.dataset.psId; - } + return element.getAttribute('data-ps-id'); } function setId(element, id) { - if (typeof element.dataset === 'undefined') { - element.setAttribute('data-ps-id', id); - } else { - element.dataset.psId = id; - } + element.setAttribute('data-ps-id', id); } function removeId(element) { - if (typeof element.dataset === 'undefined') { - element.removeAttribute('data-ps-id'); - } else { - delete element.dataset.psId; - } + element.removeAttribute('data-ps-id'); } exports.add = function (element) {