mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-14 12:47:49 +00:00
Simplify the _.support.dom check.
This commit is contained in:
22
dist/lodash.compat.js
vendored
22
dist/lodash.compat.js
vendored
@@ -500,7 +500,7 @@
|
||||
var reNative = RegExp('^' +
|
||||
String(toString)
|
||||
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||
.replace(/toString| for [^\]]+/g, '.*?') + '$'
|
||||
.replace(/\b(function)\b.*?(?=\\\()| for .+?(?=\\\])|\btoString\b/g, '$1.*?') + '$'
|
||||
);
|
||||
|
||||
/** Native method shortcuts */
|
||||
@@ -691,14 +691,6 @@
|
||||
*/
|
||||
support.argsObject = arguments.constructor == Object && !(arguments instanceof Array);
|
||||
|
||||
/**
|
||||
* Detect if the DOM is supported.
|
||||
*
|
||||
* @memberOf _.support
|
||||
* @type boolean
|
||||
*/
|
||||
support.dom = !!document && typeof document == 'object' && reNative.test(clearTimeout) && reNative.test(setTimeout);
|
||||
|
||||
/**
|
||||
* Detect if `name` or `message` properties of `Error.prototype` are
|
||||
* enumerable by default. (IE < 9, Safari < 5.1)
|
||||
@@ -791,6 +783,18 @@
|
||||
*/
|
||||
support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx';
|
||||
|
||||
/**
|
||||
* Detect if the DOM is supported.
|
||||
*
|
||||
* @memberOf _.support
|
||||
* @type boolean
|
||||
*/
|
||||
try {
|
||||
support.dom = document.createDocumentFragment().nodeType === 11;
|
||||
} catch(e) {
|
||||
support.dom = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if a DOM node's [[Class]] is resolvable (all but IE < 9)
|
||||
* and that the JS engine errors when attempting to coerce an object to
|
||||
|
||||
Reference in New Issue
Block a user