MCPcopy Create free account
hub / github.com/components/jquery / setDocument

Function setDocument

jquery.js:1412–1440  ·  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

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

Callers 4

unloadHandlerFunction · 0.70
findFunction · 0.70
jquery.jsFile · 0.70
superMatcherFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected