aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Aaron <brandon.aaron@gmail.com>2006-10-25 14:05:25 +0000
committerBrandon Aaron <brandon.aaron@gmail.com>2006-10-25 14:05:25 +0000
commitf1f3d6f300f6db94910b11f387c7f9b741627c02 (patch)
treeebdaae1e0cb2f67c38e55e73bc386e1298129bd3
parent215aab279379d65c360e28b28c9dbeafb043971f (diff)
downloadjquery-f1f3d6f300f6db94910b11f387c7f9b741627c02.tar.gz
jquery-f1f3d6f300f6db94910b11f387c7f9b741627c02.zip
Fix for jQuery.clean that caused Safari to crash with newline characters
-rw-r--r--src/jquery/jquery.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index 3816296a8..9561ea9de 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -1565,10 +1565,13 @@ 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;
- arg = div.childNodes;
- }
-
- if ( arg.length != undefined && !arg.nodeType ) // Handles Array, jQuery, DOM NodeList collections
+
+ // 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] );
+ }
+ else if ( arg.length != undefined && !arg.nodeType ) // Handles Array, jQuery, DOM NodeList collections
for ( var n = 0; n < arg.length; n++ )
r.push(arg[n]);
else