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:
commit
42364c4d43
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user