handleEvent method does not check, if current method is not event handler.
This happens because for..in method does enumerate both object's own and derived from the prototype properties.
It leads to different kinds of errors, when Object.prototype extensions are used.
It's applicable to any for..in operators in the supplied JS code.
How to fix:
add the following function to JS libs
/*
* Checks if property is derived from prototype, applies method if it is not exists
*
* @param string property name
* @return bool true if prototyped
* @access public
*/
if ('undefined' == typeof Object.hasOwnProperty) {
Object.prototype.hasOwnProperty = function (prop) {
return !(this.constructor && this.constructor.prototype[prop] && this[prop] === this.constructor.prototype[prop]);
}
}
and use
for ( var i in obj ) {
// filter prototyped properties
if (!obj.hasOwnProperty(i)) continue;
// all others will be safe
}
more code snippets you can find at
http://svn.debugger.ru/listing.php?repname=JS%20libraries&path=%2FBrowserExtensions%2Ftrunk%2F&rev=0&sc=0