[Seaside] #script: part of the tags

Sebastian Sastre ssastre at seaswork.com
Sun Sep 7 13:00:21 UTC 2008


Hi there,

Today I've found a surprising behavior (about a 'dom:loaded' event reaction
which was not executing) and debugging that lead me to the #script: method of
WATagBrush which has this code:

script: aPrototype
	aPrototype isNil
		ifTrue: [ ^ self ].
	(aPrototype respondsTo: #id:)
		ifTrue: [ aPrototype id: self ensureId ].
	aPrototype session addLoadScript: aPrototype

That means that silently Seaside decided to put the script part of the tag in
the onLoad section which is IMHO a very poor choice this days.

If the idea is to mantain that silent manipulation of the script tag, I
recommend a review to use 'dom:loaded' instead of that because it will be fired
just after the html is loaded and before the images are loaded and, depending on
the page, that could make a lot of diference to the user experience.

If not, I recommend two methods. One called #script: behaving as intuitively
expected for the tag and other with the "enhancement" but making it explicit
with something like #onDOMLoadedScript: so the Seaside developer can choose
instead of being (poorly) surprised.

Cheers,

Sebastian Sastre



More information about the seaside mailing list