[Windmill-dev] Issue with click command and preventDefault
Robert Leftwich
windmill at rtl.fmailbox.com
Fri Dec 14 20:28:15 PST 2007
I was trying to test a datatable from YUI and came across a problem with
the click processing, more specifically the use/timing of
preventDefault() in the mozController. A sample page for a YUI datatable
can be found at
http://developer.yahoo.com/yui/examples/datatable/dt_basic_clean.html
and the simple test is to click on the sortable headings, i.e.
{"params": {"id": "yui-dt0-labellink3"}, "method": "click"}
The problem is that the sortable headings are setup to work w/o js and
as such have a valid href, e.g.
http://developer.yahoo.com/yui/examples/datatable/dt_basic_clean.html?key=title
and this href is opened in windmill.controller.click(), with the result
that the page always reloads after each click on a sortable header.
The reason for this appears to be that although the
windmill.controller.click() code installs a click listener on the anchor
element to capture the current preventDefault setting, the YUI code has
a click listener at the table level, where it calls preventDefault().
Unfortunately, this is after the Windmill click handler is called, and
the result is that preventDefault in windmill.controller.click() is
false, so the href is opened.
I'm not sure of the best way to address this problem as it seems
unlikely that a coding solution will ever be able to cater for all
possible combinations of click listeners/bubbling. I wonder if a param
on the click command that specifies the required preventDefault setting
would be a more pragmatic approach?
Of course, I'm new to Windmill and may have missed something. If so,
great, just tell me what I missed and I'll continue on :-)
Robert
More information about the Windmill-dev
mailing list