mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Add compatibility for HTMLElement's dataset (#945)
This commit is contained in:
parent
f8a38de791
commit
d6e4607fd0
1 changed files with 12 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue