Fix for #4011, crash when two text nodes are appended in IE.

This commit is contained in:
Dave Methvin 2009-12-06 09:06:00 +08:00 committed by John Resig
parent 3c89e38fc2
commit 628e1564c4
2 changed files with 6 additions and 3 deletions

View file

@ -388,7 +388,7 @@ jQuery.extend({
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
var ret = [], div = context.createElement("div");
var ret = [];
jQuery.each(elems, function(i, elem){
if ( typeof elem === "number" ) {
@ -408,7 +408,8 @@ jQuery.extend({
// Trim whitespace, otherwise indexOf won't work as expected
var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0];
depth = wrap[0],
div = context.createElement("div");
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];