Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#13482 closed defect (fixed)

[CLA][PATCH] dojo/gesture incorrectly sets

Reported by: Bryan Forbes Owned by: evan
Priority: high Milestone: 1.7
Component: Events Version: 1.7.0b1
Keywords: Cc: Kris Zyp
Blocked By: Blocking:


Currently, dojo/gesture sets to the connected to node while bubbling. This is contrary to how the DOM event model works: is the node the event was dispatched on ( Because of this fact, event delegation won't work with dojo/gesture in its current state. Take the following code sample:

<div id="one">
    <div id="two"></div>
require(["dojo/on", "dojo/dom", "dojo/gesture/tap"], function(on, dom, tap){
    on(dom.byId("one"), "click", function(evt){

    on(dom.byId("one"), tap, function(evt){

If "two" is clicked, you will see "two" output on the console. If "two" is tapped, you will see "one" output on the console. Event delegation relies on the fact that is the node that the event originated from.

There are two courses of action that could be taken:

  1. Modify "fire" to take an extra argument which would be the originating element. would be set to this element. "_fire" would have to be modified to keep from setting
  2. Modify dojo/gesture to use on.emit. Since dojo/on already has a system for firing synthetic events, dojo/gesture should be leveraging on.emit rather than reinventing the wheel. on.emit correctly sets (where needed) or uses element.dispatchEvent.

This is a show stopper since event delegation will not work for gestures at this point.

Attachments (1)

gesture.diff (4.4 KB) - added by Bryan Forbes 11 years ago.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by Bryan Forbes

Attachment: gesture.diff added

comment:1 Changed 11 years ago by Bryan Forbes

Summary: dojo/gesture incorrectly sets[CLA][PATCH] dojo/gesture incorrectly sets

I attached a patch for dojo/gesture to implement setting target correctly, but I'd still like to see it use on.emit. For now, this fixes event delegation.

comment:2 Changed 11 years ago by evan

Resolution: fixed
Status: newclosed

In [26190]:

Fixes #13482 !strict , by making the correct in the fired gesture event, Bryan, thanks for the patch!

comment:3 Changed 11 years ago by evan

Thanks, Bryan,

Really nice suggestion, I'll have a try. Also will track it with #13675. Due to the possible significant changes, we may not be able to get it in for 1.7, let's discuss once I got a patch for it.

Note: See TracTickets for help on using tickets.