[Seaside] style CSS and liveCallback

Michel Bany michel.bany at gmail.com
Wed Apr 12 08:53:44 UTC 2006


On 11 Apr 2006, at 08:21 , Avi Bryant wrote:

> Never update CSS styles dynamically.  A #style method should always  
> just return a literal string.  Instead, add different CSS classes  
> for each of the possible styles you'll want, have permanent CSS  
> entries that define styles for these classes, and change the class  
> of your element dynamically when you want it to change its look.

Agreed, but as a curious person, I gave it a try and I included live- 
updated style elements in an html.

This gives you an idea about how smart the various browsers are :
1) In Firefox (the clear winner), when a style element is live- 
updated, the new style is immediately applied.
2) In Safari, the Javascript gets an exception when you try to live- 
update a style element.
You need to catch it, if you want to update the rest of the live- 
updated elements.
3) In IE, live updates of style elements are silently ignored and the  
rest of the live-updated elements are updated.

So I published  SeasideAsync-mb.38 that includes the try/catch in the  
Javascript.

Michel.


More information about the Seaside mailing list