Merge pull request #949 from notmasteryet/ie9-dataset
Add compatibility for HTMLElement's dataset
This commit is contained in:
commit
0226405b86
@ -205,3 +205,15 @@
|
|||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
// HTMLElement dataset property
|
||||||
|
(function checkDatasetProperty() {
|
||||||
|
var div = document.createElement('div');
|
||||||
|
if ('dataset' in div)
|
||||||
|
return; // dataset property exists
|
||||||
|
Object.defineProperty(HTMLElement.prototype, 'dataset', {
|
||||||
|
get: function htmlElementDatasetGetter() {
|
||||||
|
// adding dataset field to the actual object
|
||||||
|
return (this.dataset = {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user