mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Simplify the _.support.dom check.
This commit is contained in:
@@ -46,19 +46,8 @@
|
||||
|
||||
window.WinRTError = Error;
|
||||
|
||||
window.clearTimeout = (function(fn) {
|
||||
window._clearTimeout = fn;
|
||||
return function(id) {
|
||||
return fn(id);
|
||||
};
|
||||
}(clearTimeout));
|
||||
|
||||
window.setTimeout = (function(fn) {
|
||||
window._setTimeout = fn;
|
||||
return function(func, wait) {
|
||||
return fn(func, wait);
|
||||
};
|
||||
}(setTimeout));
|
||||
document._createDocumentFragment = document.createDocumentFragment;
|
||||
document.createDocumentFragment = function() {};
|
||||
}
|
||||
|
||||
function removeBizarroMethods() {
|
||||
@@ -99,11 +88,8 @@
|
||||
}
|
||||
window.WinRTError = undefined;
|
||||
|
||||
window.clearTimeout = _clearTimeout;
|
||||
window._clearTimeout = undefined;
|
||||
|
||||
window.setTimeout = _setTimeout;
|
||||
window._setTimeout = undefined;
|
||||
document.createDocumentFragment = document._createDocumentFragment;
|
||||
document._createDocumentFragment = undefined;
|
||||
|
||||
delete Array._isArray;
|
||||
delete Date._now;
|
||||
|
||||
19
test/test.js
19
test/test.js
@@ -231,15 +231,13 @@
|
||||
global.WinRTError = Error;
|
||||
|
||||
// fake dom
|
||||
var window = global.window = {};
|
||||
window.document = {};
|
||||
window.window = window;
|
||||
|
||||
var _clearTimeout = global.clearTimeout;
|
||||
global.clearTimeout = Number;
|
||||
|
||||
var _setTimeout = global.setTimeout;
|
||||
global.setTimeout = Number;
|
||||
global.window = {
|
||||
'document': {
|
||||
'createDocumentFragment': function() {
|
||||
return { 'nodeType': 11 };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// add extensions
|
||||
Function.prototype._method = function() {};
|
||||
@@ -278,9 +276,6 @@
|
||||
Object.getPrototypeOf = _getPrototypeOf;
|
||||
Object.keys = _keys;
|
||||
|
||||
global.clearTimeout = _clearTimeout;
|
||||
global.setTimeout = _setTimeout;
|
||||
|
||||
delete global.window;
|
||||
delete global.WinRTError;
|
||||
delete Function.prototype._method;
|
||||
|
||||
Reference in New Issue
Block a user