tuiHoneyPot

front and back end of my TUI honeypot
Log | Files | Refs | README

isAttached.js (798B)


      1 define( [
      2 	"../core",
      3 	"../var/documentElement",
      4 	"../selector/contains" // jQuery.contains
      5 ], function( jQuery, documentElement ) {
      6 	"use strict";
      7 
      8 	var isAttached = function( elem ) {
      9 			return jQuery.contains( elem.ownerDocument, elem );
     10 		},
     11 		composed = { composed: true };
     12 
     13 	// Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
     14 	// Check attachment across shadow DOM boundaries when possible (gh-3504)
     15 	// Support: iOS 10.0-10.2 only
     16 	// Early iOS 10 versions support `attachShadow` but not `getRootNode`,
     17 	// leading to errors. We need to check for `getRootNode`.
     18 	if ( documentElement.getRootNode ) {
     19 		isAttached = function( elem ) {
     20 			return jQuery.contains( elem.ownerDocument, elem ) ||
     21 				elem.getRootNode( composed ) === elem.ownerDocument;
     22 		};
     23 	}
     24 
     25 	return isAttached;
     26 } );