PDA

View Full Version : [FIXED][3.1] Undefined var id in ext-base-event.js



Condor
16 Dec 2009, 12:28 AM
It should probably be:

removeListener: function(el, eventName, fn) {
el = Ext.getDom(el);
var i, len, li;
if (el && fn) {
if (eventName == UNLOAD) {
if (unloadListeners[el.id] !== undefined) {
for (i = 0, len = unloadListeners[el.id].length; i < len; i++) {
li = unloadListeners[el.id][i];
if (li && li[TYPE] == eventName && li[FN] == fn) {
unloadListeners[el.id].splice(i, 1);
}
}
}
return;
}
doRemove(el, eventName, fn, false);
}
},

Condor
16 Dec 2009, 6:19 AM
Which could be shortened to:

removeListener: function(el, eventName, fn) {
el = Ext.getDom(el);
var i, len, li, lis;
if (el && fn) {
if (eventName == UNLOAD) {
if ((lis = unloadListeners[el.id]) !== undefined) {
for (i = 0, len = lis.length; i < len; i++) {
if ((li = lis[i]) && li[TYPE] == eventName && li[FN] == fn) {
lis.splice(i, 1);
}
}
}
return;
}
doRemove(el, eventName, fn, false);
}
},

mystix
16 Dec 2009, 7:00 AM
+1 to the shorter version :)

note: you have a typo in there:


lst.splice(i, 1);

should be


lis.splice(i, 1);

jay@moduscreate.com
16 Dec 2009, 9:42 AM
has three dot one dropped?

Btw, +1 :)

evant
17 Dec 2009, 5:45 AM
Fixed up, thanks.