@@ -644,7 +644,8 @@ jQuery.extend({
644
644
} ,
645
645
646
646
clean : function ( elems , context , fragment , scripts ) {
647
- var checkScriptType ;
647
+ var checkScriptType , script , j ,
648
+ ret = [ ] ;
648
649
649
650
context = context || document ;
650
651
@@ -653,8 +654,6 @@ jQuery.extend({
653
654
context = context . ownerDocument || context [ 0 ] && context [ 0 ] . ownerDocument || document ;
654
655
}
655
656
656
- var ret = [ ] , j ;
657
-
658
657
for ( var i = 0 , elem ; ( elem = elems [ i ] ) != null ; i ++ ) {
659
658
if ( typeof elem === "number" ) {
660
659
elem += "" ;
@@ -762,16 +761,17 @@ jQuery.extend({
762
761
return ! elem . type || rscriptType . test ( elem . type ) ;
763
762
} ;
764
763
for ( i = 0 ; ret [ i ] ; i ++ ) {
765
- if ( scripts && jQuery . nodeName ( ret [ i ] , "script" ) && ( ! ret [ i ] . type || ret [ i ] . type . toLowerCase ( ) === "text/javascript" ) ) {
766
- scripts . push ( ret [ i ] . parentNode ? ret [ i ] . parentNode . removeChild ( ret [ i ] ) : ret [ i ] ) ;
764
+ script = ret [ i ] ;
765
+ if ( scripts && jQuery . nodeName ( script , "script" ) && ( ! script . type || rscriptType . test ( script . type ) ) ) {
766
+ scripts . push ( script . parentNode ? script . parentNode . removeChild ( script ) : script ) ;
767
767
768
768
} else {
769
- if ( ret [ i ] . nodeType === 1 ) {
770
- var jsTags = jQuery . grep ( ret [ i ] . getElementsByTagName ( "script" ) , checkScriptType ) ;
769
+ if ( script . nodeType === 1 ) {
770
+ var jsTags = jQuery . grep ( script . getElementsByTagName ( "script" ) , checkScriptType ) ;
771
771
772
772
ret . splice . apply ( ret , [ i + 1 , 0 ] . concat ( jsTags ) ) ;
773
773
}
774
- fragment . appendChild ( ret [ i ] ) ;
774
+ fragment . appendChild ( script ) ;
775
775
}
776
776
}
777
777
}
0 commit comments