Opened 6 years ago

Closed 6 years ago

#16543 closed defect (fixed)

lastEvent comparison broken

Reported by: bill Owned by: bill
Priority: undecided Milestone: 1.9
Component: Events Version: 1.8.2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

Split from #15097. In 1.8 there's a bug on IE in this situation:

<div id="div">click me</div>
<button id="button">synthetically clicked</button>
<script>
    on(dom.byId("div"), "click", function(evt){
       evt.preventDefault();
       evt.stopPropagation();
       dom.byId("button").click();
    });
</script>

When the user clicks the <div>, the div.click listener modifies the original evt (by calling stopPropagation), and then creates a new click event on the <button>. Although the new (synthetic) click is a new event, since the two events arrive nearly simultaneously, and have the same type, the on._fixEvent processing assumes they are the same event. I.E. lastEvent matches the new event.

My [30051] tried to fix this, but broke dojo/tests/on/on (for IE). On IE, evt.target (for native events) is not defined, so I should have been checking for evt.srcElement.

Change History (2)

comment:1 Changed 6 years ago by bill

Description: modified (diff)
Milestone: tbd1.9
Owner: changed from Kris Zyp to bill
Status: newassigned

comment:2 Changed 6 years ago by bill

Resolution: fixed
Status: assignedclosed

In [30281]:

Evt.target is not set for native events on IE6-8, so need to use evt.srcElement instead. Fixes regression in dojo/tests/on/on from [30051], refs #15097 and fixes #16543 !strict.

Note: See TracTickets for help on using tickets.