diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-06-26 21:39:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-26 21:39:10 +0200 |
commit | 79b74e043a4ee737d44a95094ff1184e40bd5b16 (patch) | |
tree | 200b55efd1a472e7b3036c1e1ecf6b6afe96a317 /src/selector-native.js | |
parent | 438b1a3e8a52d3e4efd8aba45498477038849c97 (diff) | |
download | jquery-79b74e043a4ee737d44a95094ff1184e40bd5b16.tar.gz jquery-79b74e043a4ee737d44a95094ff1184e40bd5b16.zip |
Selector: Port Sizzle tests to jQuery
Apart from porting most Sizzle tests to jQuery (mostly to its selector module),
this commit fixes selector-native so that a jQuery custom compilation that
excludes Sizzle passes all tests as well.
Closes gh-4406
Diffstat (limited to 'src/selector-native.js')
-rw-r--r-- | src/selector-native.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/selector-native.js b/src/selector-native.js index 20c37f4fa..511d85d03 100644 --- a/src/selector-native.js +++ b/src/selector-native.js @@ -34,6 +34,7 @@ define( [ */ var hasDuplicate, sortInput, + rhtmlSuffix = /HTML$/i, sortStable = jQuery.expando.split( "" ).sort( sortOrder ).join( "" ) === jQuery.expando, // Support: IE 9 - 11+ @@ -199,11 +200,14 @@ jQuery.extend( { return a === bup || !!( bup && bup.nodeType === 1 && adown.contains( bup ) ); }, isXMLDoc: function( elem ) { - - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && ( elem.ownerDocument || elem ).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; + var namespace = elem.namespaceURI, + documentElement = ( elem.ownerDocument || elem ).documentElement; + + // Assume HTML when documentElement doesn't yet exist, such as inside + // document fragments. + return !rhtmlSuffix.test( namespace || + documentElement && documentElement.nodeName || + "HTML" ); }, expr: { attrHandle: {}, |