Merge pull request #468 from tonypine/master

Use only getAttribute and setAttribute to maximize browser compatibility, due to partial support of the .dataset method
This commit is contained in:
Jun 2016-03-05 20:17:54 +09:00
commit 42364c4d43

View File

@ -79,27 +79,15 @@ function Instance(element) {
} }
function getId(element) { function getId(element) {
if (typeof element.dataset === 'undefined') {
return element.getAttribute('data-ps-id'); return element.getAttribute('data-ps-id');
} else {
return element.dataset.psId;
}
} }
function setId(element, id) { function setId(element, id) {
if (typeof element.dataset === 'undefined') {
element.setAttribute('data-ps-id', id); element.setAttribute('data-ps-id', id);
} else {
element.dataset.psId = id;
}
} }
function removeId(element) { function removeId(element) {
if (typeof element.dataset === 'undefined') {
element.removeAttribute('data-ps-id'); element.removeAttribute('data-ps-id');
} else {
delete element.dataset.psId;
}
} }
exports.add = function (element) { exports.add = function (element) {