Opened 13 years ago

Closed 9 years ago

Last modified 9 years ago

#5938 closed enhancement (fixed)

There is no way to disconnect connections created via NodeList.connect()

Reported by: mrblakwell Owned by: Kris Zyp
Priority: high Milestone: 1.7
Component: Query Version: 1.0
Keywords: Cc: ptwobrussel
Blocked By: Blocking:

Description (last modified by dylan)

if I connect an event to a bunch of nodes:

var foo = dojo.query(QUERY).connect("onchange",function(){/* .... */})

there is nothing in foo that allows me to disconnect these events. there are workarounds (see below) but nothing quick and easy.

from the #dojo IRC channel:

[14:56] mrblakwell: how do I disconnect events added via dojo.query(QUERY).connect("onchange",function(){do stuff})

[14:58] slightlyoff: mrblakwell: you don't =

[14:58] mrblakwell: sweet

[14:58] slightlyoff: mrblakwell: so I've been thinking about it

[14:58] slightlyoff: mrblakwell: and I keep thinking that connect could add a this.handles()

[14:59] slightlyoff: so you could get/keep a list of the handles that any connect() creates

[14:59] slightlyoff: which you'd then pass to something like NodeList?.disconnect(handles)

[15:00] slightlyoff: mrblakwell: if you file the bug I'll take it = )

following that, ptwobrussel suggested this as a workaround:

var handles =

dojo.query("a").map(function(x) {

return dojo.connect(x, "onclick",

function(evt) { /* ... */ });


/* Sometime later... */ dojo.forEach(handles, function(x) {



Change History (10)

comment:1 Changed 13 years ago by dylan

Milestone: 1.1
Owner: changed from slightlyoff to alex

comment:2 Changed 13 years ago by bill

Milestone: 1.11.2

Move all milestone 1.1 tickets to 1.2, except for reopened tickets and tickets opened after 1.1RC1 was released.

comment:3 Changed 12 years ago by bill

Milestone: 1.2future

defer dormant enhancements to "future" (they don't look like they're getting fixed soon so might as well mark as such)

comment:4 Changed 10 years ago by Chris Mitchell

Owner: changed from alex to dylan

please review/triage

comment:5 Changed 10 years ago by dylan

Description: modified (diff)
Milestone: future1.8

comment:6 Changed 9 years ago by dylan

Milestone: 1.82.0
Owner: changed from dylan to Kris Zyp
Status: newassigned

Is this relevant for dojo/on? Assigning to Kris to consider for 2.0.

comment:7 Changed 9 years ago by bill

Component: GeneralQuery

(I've been putting the NodeList tickets under the Query category IIRC)

comment:8 Changed 9 years ago by Kris Zyp

Resolution: fixed
Status: assignedclosed

Yes, this issue was solved with dojo/on.

comment:9 Changed 9 years ago by bill

I don't get it, how does dojo/on solve this? (Also, if it's really fixed by dojo/on the milestone should be set to 1.7, to indicate that it was fixed in 1.7).

Last edited 9 years ago by bill (previous) (diff)

comment:10 Changed 9 years ago by bill

Milestone: 2.01.7

Oh I see, NodeList.on() returns a list of handles, rather than a list of nodes.

Note: See TracTickets for help on using tickets.