Commit 99e75608 authored by jeresig's avatar jeresig

Make sure that we don't try to use a detached node (that was in a fragment) as...

Make sure that we don't try to use a detached node (that was in a fragment) as a fragment in IE. Fixes #5829.
parent 726fda08
...@@ -321,7 +321,7 @@ jQuery.fn.extend({ ...@@ -321,7 +321,7 @@ jQuery.fn.extend({
parent = value && value.parentNode; parent = value && value.parentNode;
// If we're in a fragment, just use that instead of building a new one // If we're in a fragment, just use that instead of building a new one
if ( parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
results = { fragment: parent }; results = { fragment: parent };
} else { } else {
......
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup) // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected, optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null,
// Will be defined later // Will be defined later
checkClone: false, checkClone: false,
scriptEval: false, scriptEval: false,
......
...@@ -376,7 +376,8 @@ test("append(Function) with incoming value", function() { ...@@ -376,7 +376,8 @@ test("append(Function) with incoming value", function() {
}); });
test("appendTo(String|Element|Array<Element>|jQuery)", function() { test("appendTo(String|Element|Array<Element>|jQuery)", function() {
expect(13); expect(14);
var defaultText = 'Try them out:' var defaultText = 'Try them out:'
jQuery('<b>buga</b>').appendTo('#first'); jQuery('<b>buga</b>').appendTo('#first');
equals( jQuery("#first").text(), defaultText + 'buga', 'Check if text appending works' ); equals( jQuery("#first").text(), defaultText + 'buga', 'Check if text appending works' );
...@@ -429,6 +430,15 @@ test("appendTo(String|Element|Array&lt;Element&gt;|jQuery)", function() { ...@@ -429,6 +430,15 @@ test("appendTo(String|Element|Array&lt;Element&gt;|jQuery)", function() {
jQuery("<span>a</span><b>b</b>").filter("span").appendTo( div ); jQuery("<span>a</span><b>b</b>").filter("span").appendTo( div );
equals( div.children().length, 1, "Make sure the right number of children were inserted." ); equals( div.children().length, 1, "Make sure the right number of children were inserted." );
div = jQuery("#moretests div");
var num = jQuery("#main div").length;
div.remove().appendTo("#main");
equals( jQuery("#main div").length, num, "Make sure all the removed divs were inserted." );
reset();
}); });
var testPrepend = function(val) { var testPrepend = function(val) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment