Opened 15 years ago

Closed 15 years ago

#2722 closed defect (fixed)

dojo.event.browser.addListener creates closure

Reported by: guest Owned by: alex
Priority: high Milestone: 0.9
Component: Events Version: 0.4.2
Keywords: Cc:
Blocked By: Blocking:


While it's nice that dojo.event.browser.addListener attempts to fix the different event models for the various browsers, the creation of an anonymous function to perform this fix means that a later call to dojo.event.browser.removeListener with the same parameters will fail.

The documentation doesn't mention that addListener returns the anonymous function it creates. Nor does it mention the implications of the default value of the dontFix parameter -- that you'll be unable to remove the handler.

Most likely, the dontFix parameter should be changed to fixEvent where callers must deliberately request the creation of a closure.

Attachments (1)

addListenerBug.html (1.1 KB) - added by guest 15 years ago.
Test Case that demonstrates incorrect behaviour of dojo.event.addListener

Download all attachments as: .zip

Change History (2)

Changed 15 years ago by guest

Attachment: addListenerBug.html added

Test Case that demonstrates incorrect behaviour of dojo.event.addListener

comment:1 Changed 15 years ago by bill

Milestone: 0.9
Resolution: fixed
Status: newclosed

With the new architecture of 0.9 where disconnect() takes a handle (returned from connect) this is no longer an issue.

Note: See TracTickets for help on using tickets.