Simplify the _.support.dom check.

This commit is contained in:
John-David Dalton
2013-12-16 21:22:46 -08:00
parent fb432465ea
commit 39a8652708
9 changed files with 134 additions and 141 deletions

View File

@@ -690,14 +690,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)
@@ -790,6 +782,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