Opened 14 years ago

Last modified 10 years ago

#5938 closed enhancement

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

Reported by: mrblakwell Owned by: dylan
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 (5)

comment:1 Changed 14 years ago by dylan

Milestone: 1.1
Owner: changed from slightlyoff to alex

comment:2 Changed 14 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 14 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 11 years ago by Chris Mitchell

Owner: changed from alex to dylan

please review/triage

comment:5 Changed 11 years ago by dylan

Description: modified (diff)
Milestone: future1.8
Note: See TracTickets for help on using tickets.