Opened 10 years ago

Closed 10 years ago

#15392 closed defect (duplicate)

dojo.on handlers .remove() fails to remove listener for focusin event

Reported by: waltercacau Owned by: Kris Zyp
Priority: undecided Milestone: 1.8
Component: Events Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:


The following snippet exemplifies the problem

<script src=""></script>
Trigger focus and blur sometimes in following input and observe the terminal: <br/>
<input type="text" id="input" />
require(['dojo','dojo/on'], function(dojo, on) {
	var input = dojo.byId('input');
	var counter = 0;
	var handle = on(input, 'focusin', function() {
		console.log('Handle - call ' + (++counter));

		// Removing Handle 1


Try to focus and unfocus a couple of times the input box. You would expect that in the console you just see "Handle - call 1", but you will see "Handle - call 2", "Handle - call 3", ... That's because the event listener is not being removed.

I traced it to the line 139 of dojo/on.js:

target.removeEventListener(type, listener, capture);

I believe it should be

target.removeEventListener(capture ? captures[type] : type, listener, capture);


Change History (3)

comment:1 Changed 10 years ago by bill

Milestone: tbd1.8
Resolution: fixed
Status: newclosed

I fixed this in [27526] already.

comment:2 Changed 10 years ago by bill

Resolution: fixed
Status: closedreopened

Guess I should mark this as a duplicate.

comment:3 Changed 10 years ago by bill

Resolution: duplicate
Status: reopenedclosed

Duplicate of #14595.

Note: See TracTickets for help on using tickets.