11import jQuery from "./core.js" ;
22import isAttached from "./core/isAttached.js" ;
3- import flat from "./var/flat.js" ;
43import isIE from "./var/isIE.js" ;
54import push from "./var/push.js" ;
65import access from "./core/access.js" ;
76import rtagName from "./manipulation/var/rtagName.js" ;
8- import rscriptType from "./manipulation/var/rscriptType.js" ;
97import wrapMap from "./manipulation/wrapMap.js" ;
108import getAll from "./manipulation/getAll.js" ;
9+ import domManip from "./manipulation/domManip.js" ;
1110import setGlobalEval from "./manipulation/setGlobalEval.js" ;
12- import buildFragment from "./manipulation/buildFragment.js" ;
1311import dataPriv from "./data/var/dataPriv.js" ;
1412import dataUser from "./data/var/dataUser.js" ;
1513import acceptData from "./data/var/acceptData.js" ;
16- import DOMEval from "./core/DOMEval.js" ;
1714import nodeName from "./core/nodeName.js" ;
1815
1916import "./core/init.js" ;
@@ -38,21 +35,6 @@ function manipulationTarget( elem, content ) {
3835 return elem ;
3936}
4037
41- // Replace/restore the type attribute of script elements for safe DOM manipulation
42- function disableScript ( elem ) {
43- elem . type = ( elem . getAttribute ( "type" ) !== null ) + "/" + elem . type ;
44- return elem ;
45- }
46- function restoreScript ( elem ) {
47- if ( ( elem . type || "" ) . slice ( 0 , 5 ) === "true/" ) {
48- elem . type = elem . type . slice ( 5 ) ;
49- } else {
50- elem . removeAttribute ( "type" ) ;
51- }
52-
53- return elem ;
54- }
55-
5638function cloneCopyEvent ( src , dest ) {
5739 var i , l , type , pdataOld , udataOld , udataCur , events ;
5840
@@ -85,91 +67,6 @@ function cloneCopyEvent( src, dest ) {
8567 }
8668}
8769
88- function domManip ( collection , args , callback , ignored ) {
89-
90- // Flatten any nested arrays
91- args = flat ( args ) ;
92-
93- var fragment , first , scripts , hasScripts , node , doc ,
94- i = 0 ,
95- l = collection . length ,
96- iNoClone = l - 1 ,
97- value = args [ 0 ] ,
98- valueIsFunction = typeof value === "function" ;
99-
100- if ( valueIsFunction ) {
101- return collection . each ( function ( index ) {
102- var self = collection . eq ( index ) ;
103- args [ 0 ] = value . call ( this , index , self . html ( ) ) ;
104- domManip ( self , args , callback , ignored ) ;
105- } ) ;
106- }
107-
108- if ( l ) {
109- fragment = buildFragment ( args , collection [ 0 ] . ownerDocument , false , collection , ignored ) ;
110- first = fragment . firstChild ;
111-
112- if ( fragment . childNodes . length === 1 ) {
113- fragment = first ;
114- }
115-
116- // Require either new content or an interest in ignored elements to invoke the callback
117- if ( first || ignored ) {
118- scripts = jQuery . map ( getAll ( fragment , "script" ) , disableScript ) ;
119- hasScripts = scripts . length ;
120-
121- // Use the original fragment for the last item
122- // instead of the first because it can end up
123- // being emptied incorrectly in certain situations (trac-8070).
124- for ( ; i < l ; i ++ ) {
125- node = fragment ;
126-
127- if ( i !== iNoClone ) {
128- node = jQuery . clone ( node , true , true ) ;
129-
130- // Keep references to cloned scripts for later restoration
131- if ( hasScripts ) {
132- jQuery . merge ( scripts , getAll ( node , "script" ) ) ;
133- }
134- }
135-
136- callback . call ( collection [ i ] , node , i ) ;
137- }
138-
139- if ( hasScripts ) {
140- doc = scripts [ scripts . length - 1 ] . ownerDocument ;
141-
142- // Reenable scripts
143- jQuery . map ( scripts , restoreScript ) ;
144-
145- // Evaluate executable scripts on first document insertion
146- for ( i = 0 ; i < hasScripts ; i ++ ) {
147- node = scripts [ i ] ;
148- if ( rscriptType . test ( node . type || "" ) &&
149- ! dataPriv . access ( node , "globalEval" ) &&
150- jQuery . contains ( doc , node ) ) {
151-
152- if ( node . src && ( node . type || "" ) . toLowerCase ( ) !== "module" ) {
153-
154- // Optional AJAX dependency, but won't run scripts if not present
155- if ( jQuery . _evalUrl && ! node . noModule ) {
156- jQuery . _evalUrl ( node . src , {
157- nonce : node . nonce ,
158- crossOrigin : node . crossOrigin
159- } , doc ) ;
160- }
161- } else {
162- DOMEval ( node . textContent , node , doc ) ;
163- }
164- }
165- }
166- }
167- }
168- }
169-
170- return collection ;
171- }
172-
17370function remove ( elem , selector , keepData ) {
17471 var node ,
17572 nodes = selector ? jQuery . filter ( selector , elem ) : elem ,
0 commit comments