X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=996ace8664eafa837c71b1ce382e6eace1deaca0;hb=4f92b3430119e734dea39ab4f4636e64d2c26903;hp=c17d6248bc9bf1dc9daa30d00e6174cde3d23c66;hpb=ddd110c9e583fb43257ae1b9b06223bdc7e21f31;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index c17d624..996ace8 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1565,14 +1565,12 @@ jQuery.extend({ // Go to html and back, then peel off extra wrappers div.innerHTML = wrap[1] + s + wrap[2]; while ( wrap[0]-- ) div = div.firstChild; - - // Have to loop through the childNodes here to - // prevent a Safari crash with text nodes and /n characters - for ( var j = 0; j < div.childNodes.length; j++ ) - r.push( div.childNodes[j] ); + arg = div.childNodes; } - else if ( arg.length != undefined && !arg.nodeType ) // Handles Array, jQuery, DOM NodeList collections - for ( var n = 0; n < arg.length; n++ ) + + + if ( arg.length != undefined && ( (jQuery.browser.safari && typeof arg == 'function') || !arg.nodeType ) ) // Safari reports typeof on a DOM NodeList to be a function + for ( var n = 0; n < arg.length; n++ ) // Handles Array, jQuery, DOM NodeList collections r.push(arg[n]); else r.push( arg.nodeType ? arg : document.createTextNode(arg.toString()) );