mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #8643 from Snuffleupagus/polyfill-Number-isNaN
Add `Number.isNaN` and `Number.isInteger` polyfills in compatibility.js, since the Streams polyfill relies on them
This commit is contained in:
commit
a63015a9a2
1 changed files with 23 additions and 0 deletions
|
@ -836,6 +836,29 @@ PDFJS.compatibilityChecked = true;
|
|||
};
|
||||
})();
|
||||
|
||||
// Provides support for Number.isNaN in legacy browsers.
|
||||
// Support: IE.
|
||||
(function checkNumberIsNaN() {
|
||||
if (Number.isNaN) {
|
||||
return;
|
||||
}
|
||||
Number.isNaN = function(value) {
|
||||
return typeof value === 'number' && isNaN(value);
|
||||
};
|
||||
})();
|
||||
|
||||
// Provides support for Number.isInteger in legacy browsers.
|
||||
// Support: IE.
|
||||
(function checkNumberIsInteger() {
|
||||
if (Number.isInteger) {
|
||||
return;
|
||||
}
|
||||
Number.isInteger = function(value) {
|
||||
return typeof value === 'number' && isFinite(value) &&
|
||||
Math.floor(value) === value;
|
||||
};
|
||||
})();
|
||||
|
||||
/**
|
||||
* Polyfill for Promises:
|
||||
* The following promise implementation tries to generally implement the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue