contains.js (418B)
1 define( [ 2 "../core" 3 ], function( jQuery ) { 4 5 "use strict"; 6 7 // Note: an element does not contain itself 8 jQuery.contains = function( a, b ) { 9 var bup = b && b.parentNode; 10 11 return a === bup || !!( bup && bup.nodeType === 1 && ( 12 13 // Support: IE 9 - 11+ 14 // IE doesn't have `contains` on SVG. 15 a.contains ? 16 a.contains( bup ) : 17 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 18 ) ); 19 }; 20 21 } );