MCPcopy
hub / github.com/jquery/jquery / setDocument

Function setDocument

dist-module/jquery.module.js:1398–1426  ·  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

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

Callers 4

unloadHandlerFunction · 0.70
findFunction · 0.70
jQueryFactoryFunction · 0.70
superMatcherFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected