buildFragment: function( elems, context, scripts, selection ) {
var elem, tmp, tag, wrap, contains, j,
i = 0,
+ l = elems.length,
fragment = context.createDocumentFragment(),
nodes = [];
- while ( ( elem = elems[ i++ ] ) || elem === 0 ) {
+ for ( ; i < l; i++ ) {
+ elem = elems[ i ];
+
+ if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
// Support: Webkit, IE
tmp.textContent = "";
}
+ }
}
// Remove wrapper from fragment
i = 0;
while ( (elem = nodes[ i++ ]) ) {
- contains = jQuery.contains( elem.ownerDocument, elem );
// #4087 - If origin and destination elements are the same, and this is
// that element, do not do anything
continue;
}
+ contains = jQuery.contains( elem.ownerDocument, elem );
+
// Append to fragment
tmp = getAll( fragment.appendChild( elem ), "script" );
// Capture executables
if ( scripts ) {
-
j = 0;
while ( (elem = tmp[ j++ ]) ) {
if ( rscriptType.test( elem.type || "" ) ) {
var testAppend = function( valueObj ) {
- expect( 77 );
+ expect( 78 );
testAppendForObject( valueObj, false );
testAppendForObject( valueObj, true );
jQuery("#table colgroup").append( valueObj("<col/>") );
equal( jQuery("#table colgroup col").length, 1, "Append col" );
-
jQuery("#form")
.append( valueObj("<select id='appendSelect1'></select>") )
.append( valueObj("<select id='appendSelect2'><option>Test</option></select>") );
t( "Append Select", "#appendSelect1, #appendSelect2", [ "appendSelect1", "appendSelect2" ] );
equal( "Two nodes", jQuery("<div />").append( "Two", " nodes" ).text(), "Appending two text nodes (#4011)" );
+ equal( jQuery("<div />").append( "1", "", 3 ).text(), "13", "If median is false-like value, subsequent arguments should not be ignored" );
// using contents will get comments regular, text, and comment nodes
j = jQuery("#nonnodes").contents();