-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove IE specific hacks #477
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,13 +47,13 @@ | |
|
||
/** | ||
* @typedef RequestAnimationFrame | ||
* @property {function(number):void} requestAnimationFrame | ||
Check warning on line 50 in src/fake-timers-src.js GitHub Actions / lint
|
||
* @returns {number} - the id | ||
*/ | ||
|
||
/** | ||
* @typedef Performance | ||
* @property {function(): number} now | ||
Check warning on line 56 in src/fake-timers-src.js GitHub Actions / lint
|
||
*/ | ||
|
||
/* eslint-disable jsdoc/require-property-description */ | ||
|
@@ -143,8 +143,6 @@ | |
* @returns {FakeTimers} | ||
*/ | ||
function withGlobal(_global) { | ||
const userAgent = _global.navigator && _global.navigator.userAgent; | ||
const isRunningInIE = userAgent && userAgent.indexOf("MSIE ") > -1; | ||
const maxTimeout = Math.pow(2, 31) - 1; //see https://heycam.github.io/webidl/#abstract-opdef-converttoint | ||
const idCounterStart = 1e12; // arbitrarily large number to avoid collisions with native timer IDs | ||
const NOOP = function () { | ||
|
@@ -188,26 +186,6 @@ | |
_global.setImmediate && typeof _global.setImmediate === "function"; | ||
const intlPresent = _global.Intl && typeof _global.Intl === "object"; | ||
|
||
// Make properties writable in IE, as per | ||
// https://www.adequatelygood.com/Replacing-setTimeout-Globally.html | ||
/* eslint-disable no-self-assign */ | ||
if (isRunningInIE) { | ||
_global.setTimeout = _global.setTimeout; | ||
_global.clearTimeout = _global.clearTimeout; | ||
_global.setInterval = _global.setInterval; | ||
_global.clearInterval = _global.clearInterval; | ||
_global.Date = _global.Date; | ||
} | ||
|
||
// setImmediate is not a standard function | ||
// avoid adding the prop to the window object if not present | ||
if (setImmediatePresent) { | ||
_global.setImmediate = _global.setImmediate; | ||
_global.clearImmediate = _global.clearImmediate; | ||
} | ||
|
||
/* eslint-enable no-self-assign */ | ||
|
||
_global.clearTimeout(timeoutResult); | ||
|
||
const NativeDate = _global.Date; | ||
|
@@ -329,7 +307,7 @@ | |
return timer && timer.callAt >= from && timer.callAt <= to; | ||
} | ||
|
||
/** | ||
Check warning on line 310 in src/fake-timers-src.js GitHub Actions / lint
|
||
* @param {Clock} clock | ||
* @param {Timer} job | ||
*/ | ||
|
@@ -665,7 +643,7 @@ | |
} | ||
|
||
/* eslint consistent-return: "off" */ | ||
/** | ||
Check warning on line 646 in src/fake-timers-src.js GitHub Actions / lint
|
||
* Timer comparitor | ||
* | ||
* @param {Timer} a | ||
|
@@ -797,7 +775,7 @@ | |
} | ||
} | ||
|
||
/** | ||
Check warning on line 778 in src/fake-timers-src.js GitHub Actions / lint
|
||
* Gets clear handler name for a given timer type | ||
* | ||
* @param {string} ttype | ||
|
@@ -809,7 +787,7 @@ | |
return `clear${ttype}`; | ||
} | ||
|
||
/** | ||
Check warning on line 790 in src/fake-timers-src.js GitHub Actions / lint
|
||
* Gets schedule handler name for a given timer type | ||
* | ||
* @param {string} ttype | ||
|
@@ -821,7 +799,7 @@ | |
return `set${ttype}`; | ||
} | ||
|
||
/** | ||
Check warning on line 802 in src/fake-timers-src.js GitHub Actions / lint
|
||
* Creates an anonymous function to warn only once | ||
*/ | ||
function createWarnOnce() { | ||
|
@@ -833,7 +811,7 @@ | |
} | ||
const warnOnce = createWarnOnce(); | ||
|
||
/** | ||
Check warning on line 814 in src/fake-timers-src.js GitHub Actions / lint
|
||
* @param {Clock} clock | ||
* @param {number} timerId | ||
* @param {string} ttype | ||
|
@@ -1022,8 +1000,8 @@ | |
|
||
/** | ||
* @typedef {object} Timers | ||
* @property {setTimeout} setTimeout | ||
Check warning on line 1003 in src/fake-timers-src.js GitHub Actions / lint
|
||
* @property {clearTimeout} clearTimeout | ||
Check warning on line 1004 in src/fake-timers-src.js GitHub Actions / lint
|
||
* @property {setInterval} setInterval | ||
* @property {clearInterval} clearInterval | ||
* @property {Date} Date | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node actually has setImmediate as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, not removing that. Just the IE (IE 8 and below) specific x=x hack/workaround to make the prop writable. See https://www.adequatelygood.com/Replacing-setTimeout-Globally.html
setImmediate
is still added to the timers way below (line 1032)