MCPcopy Index your code
hub / github.com/jquery/jquery / setDocument

Function setDocument

dist-module/jquery.factory.slim.module.js:1403–1431  ·  view source on GitHub ↗

* Sets document-related variables once based on the current document * @param {Element|Object} [node] An element or document object to use to set the document

( node )

Source from the content-addressed store, hash-verified

1401 * @param {Element|Object} [node] An element or document object to use to set the document
1402 */
1403function setDocument( node ) {
1404 var subWindow,
1405 doc = node ? node.ownerDocument || node : document$1;
1406
1407 // Return early if doc is invalid or already selected
1408 // Support: IE 11+
1409 // IE sometimes throws a "Permission denied" error when strict-comparing
1410 // two documents; shallow comparisons work.
1411 // eslint-disable-next-line eqeqeq
1412 if ( doc == document || doc.nodeType !== 9 ) {
1413 return;
1414 }
1415
1416 // Update global variables
1417 document = doc;
1418 documentElement = document.documentElement;
1419 documentIsHTML = !jQuery.isXMLDoc( document );
1420
1421 // Support: IE 9 - 11+
1422 // Accessing iframe documents after unload throws "permission denied" errors (see trac-13936)
1423 // Support: IE 11+
1424 // IE sometimes throws a "Permission denied" error when strict-comparing
1425 // two documents; shallow comparisons work.
1426 // eslint-disable-next-line eqeqeq
1427 if ( isIE && document$1 != document &&
1428 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1429 subWindow.addEventListener( "unload", unloadHandler );
1430 }
1431}
1432
1433find.matches = function( expr, elements ) {
1434 return find( expr, null, null, elements );

Callers 4

unloadHandlerFunction · 0.70
findFunction · 0.70
jQueryFactoryWrapperFunction · 0.70
superMatcherFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected