PDA

View Full Version : AddEvent / FireEvent any problem ?



aryl
18 Jul 2012, 5:16 AM
hello,

While i was debuging an observable object, I took a look into the Ext.util.Observable source code.

I notice the fireEvent method make a toLowercase before testing the events exitence.



fireEvent : function(eventName) {
eventName = eventName.toLowerCase();
var me = this, events = me.events,
event = events && events[eventName], ret = true;


// Only continue firing the event if there are listeners to be informed.
// Bubbled events will always have a listener count, so will be fired.
if (event && me.hasListeners[eventName]) {
ret = me.continueFireEvent(eventName, Ext.Array.slice(arguments, 1), event.bubble);
}
return ret;
},


but in the addEvents methods the events array is populated without making a toLowerCase before



addEvents : function(o) {
var me = this, events = me.events || (me.events = {}), arg, args, i;
if (typeof o == 'string') {
for (args = arguments, i = args.length; i--;) {
arg = args[i];
if (!events[arg]) {
events[arg] = true;
}
}
} else {
Ext.applyIf(me.events, o);
}
},


So when i use the addEvent with event name containing some upper case caharacter i'm not abble to fire an event.

Is it a bug or made I something wrong ?

Thanks

Romick
18 Jul 2012, 6:49 AM
Thats mean that all event should be added in lower case to be fired.