Seaside
Seaside copied to clipboard
JQScriptGenerator changes event attribute methods so they don't create the attribute
Philippe and I were discussing this at ESUG - it's been sitting in my email
inbox as a todo since then so I want to put it here so it isn't lost.
We noticed that all the event attribute methods on WATagBrush (#onChange,
#onSelect:, etc) delegate through the script generator and that
JQScriptGenerator implements #event:do:on: such that the attribute requested is
never actually created (IDs are instead generated and load scripts are added).
We weren't convinced this was very nice since behaviour on WATagBrush tends to
be pretty low-level and fairly directly mapped to HTML. This implementation
makes it tricker to generate specific HTML (you would have to resort to using
#attributeAt:put:).
Our suggestion was to have have the methods that map to attribute names simply
set the attributes and have a higher-level interface that can make smarter
decisions. Rather than implementing a duplicate set of methods for all the
events, perhaps WATagBrush could simply implement #on:do:? (or #on:script: or
similar? it's maybe better not to reuse #on:do: here...). The first parameter
could be strings/symbols or maybe it would be nicer to have some kind of
JSEvent object(s) that could be passed in?
Original issue reported on code.google.com by [email protected] on 12 Jan 2012 at 9:49