[Seaside] Live update (XMLHttpRequest) to update 3 dependent lists (<select>)

John Pierce john.raymond.pierce at gmail.com
Tue Feb 8 16:27:13 CET 2005


Hi Yar,

> That's odd, I am testing primarily with FireFox and it seems that it
> doesn't run the new script blocks

Hmm, maybe I remember incorrectly about this.  If I recall I do know
that IE wouldn't even parse the new script nodes that come back (i.e.
it ejects them from the string when you set the return string as
innerHTML on some new element).

So maybe (I can't really remember) neither browser ran the new scripts
and IE got really mad and totally ejected the new scripts from the DOM
(because MS is all about security these days, right?).

> Following what you suggested, I
> added something to WAScriptLibrary>>liveUpdate.
> This seems to work (although restricted to 1 script block, it seems
> safe for us to assume this)

I made my liveweb handler process all returned script blocks because I
was expecting more than one returned script.  When you write your own
parser of the results you can pretty easily in one pass find and
execute all script blocks.

> (since John commented that regexp is slow for his purposes) to be
> proposed to Avi for addition. Anyone suggest some changes or
> improvements?

The really goofy thing is that FireFox javascript regex works pretty
well (from a performance standpoint), but IE javascript regex (still a
popular platform) just gets buried by certain regex input strings and
sometimes the parsing for scripts to evaluate would take upwards of 90
seconds.  When I rolled my own parser and evaluator of returned
scripts I got it down to a few hundred milliseconds consistently.

The trouble here is that it largely depends upon the size of the
returned result string from the server.  Small live updates will work
fine using regex to find the scripts.  Get beyond a few K and you run
into real regex performance issues.

> John: How do you handle situations where the browser does execute the
> code automatically? Browser name/version check? 

I didn't do a browser version check because maybe no browser executes
the scripts you inject back into the DOM.    I'd have to write a test
to see (should be easy enough to find out if FireFox or IE does this).

Regards,

John
-- 
Only the mediocre are always at their best. -- Jean Giraudoux


More information about the Seaside mailing list