contains.js 418 B

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