[Seaside] [FIX] liverUpdate JavaScript problem

Pennell, David DPennell at quallaby.com
Fri Jan 7 18:47:51 CET 2005


The liveUpdate support doesn't work if your content includes a carriage
return.  
I'm not sure what Squeak & Commanche do, but on VW with WebToolKit,
sending 
strings with ebedded cr's actually sends a cr to the browser.

Changing the following line in WAStandardScripts>>liveUpdate:
    var regex = /<(\w+).*?id="(\w+)".*?>((.|\n)*)<\/\1>/;
to:
    var regex = /<(\w+).*?id="(\w+)".*?>((.|\n|\r)*)<\/\1>/;

seems to do the trick.

VW/WebToolKit running on Solaris to Mozilla Firefox on Windows XP.

Finding this was a real PITA - the cr's are removed when displaying 
strings with alert().

Also - this regex matches a lot more than I expected.  
The total match is the entire <html>...</html> range. Results[3] is from
the body of the first tag with an id up to and including the </html>
close tag.  The browser just stops when it finds an appropriate closing
tag.  I built a version of the regex that tightened this up, but then
realized that the tighter version won't handle nested elements.  Neither
version will handled nested elements where the element tags are the same
(e.g. <span id="foo"><span></span></span> won't work, but <div
id="foo"><span></span></div> will work.


More information about the Seaside mailing list