return scripts ?
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
fragment.appendChild( elem );
}
};
for ( i = 0; (elem = ret[i]) != null; i++ ) {
// Check if we’re done after handling an executable script
if ( !( jQuery.nodeName( elem, “script” ) && handleScript( elem ) ) ) {
// Append to fragment and handle embedded scripts
// 将elem元素添加到文档碎片中并处理嵌入的脚本(script标签元素)
fragment.appendChild( elem );
if ( typeof elem.getElementsByTagName !== “undefined” ) {
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName(“script”) ), handleScript );
// Splice the scripts into ret after their former ancestor and advance our index beyond them
// 将script标签添加到数组,位置为其原父元素索引位置后
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );










