[Windmill-dev] Issue with click command and preventDefault
Adam Christian
adam at osafoundation.org
Mon Dec 17 17:23:11 PST 2007
Robert,
After trying to tackle this issue various ways I decided to analyze
the current click code we were using in windmill and realized that it
was very legacy and sub optimal, so I wound up redoing most of it.
Fortunately the result is that we don't need a special method, any
special mode for hanging the default behaviors.. this should just work
now out of the box with the 'click' method. I hope this rewrite will
save us from some future pitfalls!
I tested this on ff,saf and ie7.. please get the trunk and give this a
try when you get a moment. It was a relatively big change so if you
(or anyone else out there) notices big issues please let me know ASAP.
Adam
On Dec 14, 2007, at 8:28 PM, Robert Leftwich wrote:
> 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
>
>
> _______________________________________________
> Windmill-dev mailing list
> Windmill-dev at osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/windmill-dev
More information about the Windmill-dev
mailing list