diff options
author | Saptak Sengupta <saptak013@gmail.com> | 2018-03-05 23:27:03 +0530 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2018-03-05 18:57:03 +0100 |
commit | 662083ed7bfea6bad5f9cd4060dab77c1f32aacd (patch) | |
tree | 20121cf09841f13d743d90e39b5f53c491ff6d29 /src/manipulation.js | |
parent | 09684ba3f210594e41ecddf369ac94c688d53ccb (diff) | |
download | jquery-662083ed7bfea6bad5f9cd4060dab77c1f32aacd.tar.gz jquery-662083ed7bfea6bad5f9cd4060dab77c1f32aacd.zip |
Core: Use isAttached to check for attachment of element
This change replaces the use of contains to check for attachment
by isAttached function
Closes gh-3977
Ref gh-3504
Diffstat (limited to 'src/manipulation.js')
-rw-r--r-- | src/manipulation.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/manipulation.js b/src/manipulation.js index 142e296ad..3c6d59262 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -1,5 +1,6 @@ define( [ "./core", + "./var/isAttached", "./var/concat", "./var/isFunction", "./var/push", @@ -23,7 +24,7 @@ define( [ "./traversing", "./selector", "./event" -], function( jQuery, concat, isFunction, push, access, +], function( jQuery, isAttached, concat, isFunction, push, access, rcheckableType, rtagName, rscriptType, wrapMap, getAll, setGlobalEval, buildFragment, support, dataPriv, dataUser, acceptData, DOMEval, nodeName ) { @@ -223,7 +224,7 @@ function remove( elem, selector, keepData ) { } if ( node.parentNode ) { - if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { + if ( keepData && isAttached( node ) ) { setGlobalEval( getAll( node, "script" ) ); } node.parentNode.removeChild( node ); @@ -241,7 +242,7 @@ jQuery.extend( { clone: function( elem, dataAndEvents, deepDataAndEvents ) { var i, l, srcElements, destElements, clone = elem.cloneNode( true ), - inPage = jQuery.contains( elem.ownerDocument, elem ); + inPage = isAttached( elem ); // Fix IE cloning issues if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && |