Opened 14 years ago

Last modified 10 years ago

#5938 closed enhancement

There is no way to disconnect connections created via NodeList.connect() — at Initial Version

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


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 (0)

Note: See TracTickets for help on using tickets.