mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Regression was introduced in 22ad8723ce
most likely because the clown who fixed http://bugs.jquery.com/ticket/4011 didn't add a unit test.
This commit is contained in:
parent
7d076f5d79
commit
b6a7d022ee
@ -638,8 +638,8 @@ jQuery.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
clean: function( elems, context, fragment, scripts ) {
|
clean: function( elems, context, fragment, scripts ) {
|
||||||
var j, safe, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
|
var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
|
||||||
i = 0,
|
safe = context === document && safeFragment,
|
||||||
ret = [];
|
ret = [];
|
||||||
|
|
||||||
// Ensure that context is a document
|
// Ensure that context is a document
|
||||||
@ -648,7 +648,7 @@ jQuery.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use the already-created safe fragment if context permits
|
// Use the already-created safe fragment if context permits
|
||||||
for ( safe = context === document && safeFragment; (elem = elems[i]) != null; i++ ) {
|
for ( i = 0; (elem = elems[i]) != null; i++ ) {
|
||||||
if ( typeof elem === "number" ) {
|
if ( typeof elem === "number" ) {
|
||||||
elem += "";
|
elem += "";
|
||||||
}
|
}
|
||||||
@ -664,7 +664,8 @@ jQuery.extend({
|
|||||||
} else {
|
} else {
|
||||||
// Ensure a safe container in which to render the html
|
// Ensure a safe container in which to render the html
|
||||||
safe = safe || createSafeFragment( context );
|
safe = safe || createSafeFragment( context );
|
||||||
div = div || safe.appendChild( context.createElement("div") );
|
div = context.createElement("div");
|
||||||
|
safe.appendChild( div );
|
||||||
|
|
||||||
// Fix "XHTML"-style tags in all browsers
|
// Fix "XHTML"-style tags in all browsers
|
||||||
elem = elem.replace(rxhtmlTag, "<$1></$2>");
|
elem = elem.replace(rxhtmlTag, "<$1></$2>");
|
||||||
@ -707,21 +708,20 @@ jQuery.extend({
|
|||||||
|
|
||||||
elem = div.childNodes;
|
elem = div.childNodes;
|
||||||
|
|
||||||
// Remember the top-level container for proper cleanup
|
// Take out of fragment container (we need a fresh div each time)
|
||||||
div = safe.lastChild;
|
div.parentNode.removeChild( div );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( elem.nodeType ) {
|
if ( elem.nodeType ) {
|
||||||
ret.push( elem );
|
ret.push( elem );
|
||||||
} else {
|
} else {
|
||||||
ret = jQuery.merge( ret, elem );
|
jQuery.merge( ret, elem );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix #11356: Clear elements from safeFragment
|
// Fix #11356: Clear elements from safeFragment
|
||||||
if ( div ) {
|
if ( div ) {
|
||||||
safe.removeChild( div );
|
|
||||||
elem = div = safe = null;
|
elem = div = safe = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1934,6 +1934,20 @@ test("checked state is cloned with clone()", function(){
|
|||||||
equal( jQuery(elem).clone().attr("id","clone")[0].checked, true, "Checked true state correctly cloned" );
|
equal( jQuery(elem).clone().attr("id","clone")[0].checked, true, "Checked true state correctly cloned" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("manipulate mixed jQuery and text (#12384, #12346)", function() {
|
||||||
|
expect(2);
|
||||||
|
|
||||||
|
var div = jQuery("<div>a</div>").append( " ", jQuery("<span>b</span>"), " ", jQuery("<span>c</span>") ),
|
||||||
|
nbsp = String.fromCharCode(160);
|
||||||
|
equal( div.text(), "a" + nbsp + "b" + nbsp+ "c", "Appending mixed jQuery with text nodes" );
|
||||||
|
|
||||||
|
div = jQuery("<div><div></div></div>")
|
||||||
|
.find("div")
|
||||||
|
.after("<p>a</p>", "<p>b</p>" )
|
||||||
|
.parent();
|
||||||
|
equal( div.find("*").length, 3, "added 2 paragraphs after inner div" );
|
||||||
|
});
|
||||||
|
|
||||||
testIframeWithCallback( "buildFragment works even if document[0] is iframe's window object in IE9/10 (#12266)", "manipulation/iframe-denied.html", function( test ) {
|
testIframeWithCallback( "buildFragment works even if document[0] is iframe's window object in IE9/10 (#12266)", "manipulation/iframe-denied.html", function( test ) {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user