Dave Methvin schrieb:
> Brandon committed that change, but I wrote it. Unfortunately, I don't have
> Mac here so I can't test with Safari. 
> 
> jQuery.trim only trims leading/trailing space, so the newlines between the
> <li> elements would be untouched. If there are no newlines it works?

Yes, it worked fine when I stripped the HTML myself on server-side, but 
that cannot be the solution of course.


> Is it crashing right on line 1568, or is it lower down where it pulls the
> elements out of arg?
> 
> Perhaps it is dying on the "if" right below that? No reason for it to do
> that but who knows. Instead of letting it fall into the loop replace line
> 1568 (arg = div.childNodes) with this:
> 
>       for ( var n = 0; n < div.childNodes.length; n++ )
>               r.push(div.childNodes[n]);
>       return;

It was dying on the if... I removed the check !arg.nodeType for testing 
and it worked (commenting out the other stuff)

Anyway, the text nodes contained in the node list caused the crash. 
Strange...


-- Klaus


> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Klaus Hartl
> Sent: Wednesday, October 25, 2006 9:17 AM
> To: jQuery Discussion.
> Subject: [jQuery] Critical fix: clean lets Safari crash under
> certaincircumstances
> 
> Hi all,
> 
> with the latest Revision the clean function lets Safari crash under certain
> circumstances (I had to fix that for Plazes):
> 
> There is an <ul> to which some <li> elements should be appended. These <li>s
> are loaded via XHR as text/html and are appended in the success function
> like this:
> 
> success: function(html) {
>      $('#photos').append(html);
> }
> 
> The server returns an HTML snippet like the following:
> 
> <li>...</li>
> <li>...</li>
> 
> Important: there is a line break after the closing li tag. In the clean
> function, on line 1568 there is the following code:
> 
> arg = div.childNodes
> 
> which returns a node list containing the children (first level) of the
> temporary div, of the form:
> 
> [<li>, Text \n , <li>, Text \n, ... ]
> 
> The line-break text nodes are causing Safari to crash completely!
> 
> I fixed that by changing line 1568 to this:
> arg = $('>*', div).get();
> 
> Not sure if that is the best solution. Maybe the trim function does not work
> correct?
> 
> If solution is OK, I'd commit that...
> 
> 
> -- Klaus
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to