[Windmill-dev] Issue with click command and preventDefault

Adam Christian adam at osafoundation.org
Sat Dec 15 17:50:50 PST 2007


I still haven't really had a chance to dig into this, but I did notice  
that as clicking that link does cause the problem you are seeing, if  
you click the div around it they don't have HREF associated and don't  
have the problem:

{"params": {"id": "yui-dt0-container4"}, "method": "click"}

That appears to do what you are wanting to do.

However the event bubbling/propagation issue is still at large, I'll  
give that some thought and see if I can come up with a solution  
tomorrow.

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