Browse Source

Add `Number.isNaN` and `Number.isInteger` polyfills in compatibility.js, since the Streams polyfill relies on them

Without this, the Streams polyfill will fail in Internet Explorer when the code-paths containing these methods are used.
Jonas Jenwald 8 years ago
parent
commit
f2270252c7
  1. 23
      src/shared/compatibility.js

23
src/shared/compatibility.js

@ -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: * Polyfill for Promises:
* The following promise implementation tries to generally implement the * The following promise implementation tries to generally implement the

Loading…
Cancel
Save