[Seaside] Quick question

William E Harford seaside at harford.org
Thu Oct 20 17:59:15 UTC 2005


So how would an ancestor of WAScriptLibrary be able to override a body
callback if it was specified in the HTML? Am I missing something
obvious?

I am pretty sure this can be done pragmatically in JavaScript. 
I have not tried it but would something like the below work?

...

oldOnload = document.body.onload;
function newOnload(){
    oldOnload();
    whatEver();
}
document.body.onload = newOnload;

...

Again I have not tried this so it may or may not work. 

It also seams kind of inconsistent to have seaside handle the body's
onload callback in this new manner but not any other callbacks. 

Avi , can you explain a little more where you wanted to go with this? 

My dream html renderer would allow me to manipulate  any arbitrary part
of the yet to be sent html page. So for example ....

(html root tag: 'body') onLoad:'newAttributeValue();'.

So instead of constructing the html page in a top down manner it would
be constructed in a outside in manner. (do you follow?).

I created a PHP frame work that did this to a certain extent.

Will

> >> I also removed the onLoad body callback. It was conflicting with  
> >> one of
> >> my JavaScript libraries. Specifying a onLoad callback in the html  
> >> body
> >> tag I think goes against the modular nature of Seaside, it's much  
> >> better
> >> to specify your body callbacks in the script library
> >> (document.body.onload = function).
> >>
> >
> > We experienced the same problem.
> 
> Well, it was exactly to improve modularity that I added it.  The body  
> can only have one onLoad function, which makes it nearly impossible  
> for any single component to do anything at load time - you'd never  
> know if you were replacing something that's already there.  Hence,  
> Seaside takes over onLoad for itself and then lets any component add  
> to the onLoad() function it generates (at the end of the body  
> response, so that the rendering pass can add to it).  This is  
> especially useful for JS effects like the "yellow fade technique"  
> popularized by 37signals.
> 
> So, while it may cause some short term breakage, I believe this is a  
> better long term solution.
> 
> Avi
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> 
> 
-- 
William Harford <will at harford.org>



More information about the Seaside mailing list