mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-14 20:57:49 +00:00
Simplify the _.support.dom check.
This commit is contained in:
22
dist/lodash.js
vendored
22
dist/lodash.js
vendored
@@ -474,7 +474,7 @@
|
||||
var reNative = RegExp('^' +
|
||||
String(toString)
|
||||
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||
.replace(/toString| for [^\]]+/g, '.*?') + '$'
|
||||
.replace(/\b(function)\b.*?(?=\\\()| for .+?(?=\\\])|\btoString\b/g, '$1.*?') + '$'
|
||||
);
|
||||
|
||||
/** Native method shortcuts */
|
||||
@@ -620,14 +620,6 @@
|
||||
*/
|
||||
var support = lodash.support = {};
|
||||
|
||||
/**
|
||||
* Detect if the DOM is supported.
|
||||
*
|
||||
* @memberOf _.support
|
||||
* @type boolean
|
||||
*/
|
||||
support.dom = !!document && typeof document == 'object' && reNative.test(clearTimeout) && reNative.test(setTimeout);
|
||||
|
||||
/**
|
||||
* Detect if functions can be decompiled by `Function#toString`
|
||||
* (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps).
|
||||
@@ -645,6 +637,18 @@
|
||||
*/
|
||||
support.funcNames = typeof Function.name == 'string';
|
||||
|
||||
/**
|
||||
* Detect if the DOM is supported.
|
||||
*
|
||||
* @memberOf _.support
|
||||
* @type boolean
|
||||
*/
|
||||
try {
|
||||
support.dom = document.createDocumentFragment().nodeType === 11;
|
||||
} catch(e) {
|
||||
support.dom = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* By default, the template delimiters used by Lo-Dash are similar to those in
|
||||
* embedded Ruby (ERB). Change the following template settings to use alternative
|
||||
|
||||
Reference in New Issue
Block a user