Monday, November 02, 2009
Prototype - Event.fire exception to be handled for IE
Prototype 1.6 has introduced Event.fire API that works pretty well in Firefox but experienced a problem in IE (7).
Exception was being thrown in Event.fire API that needed a special treat.
The highlighted workaround worked for me:
Exception was being thrown in Event.fire API that needed a special treat.
The highlighted workaround worked for me:
fire: function(element, eventName, memo) {Example:
// ...
if (document.createEvent) {
element.dispatchEvent(event);
} else {
try{
element.fireEvent(event.eventType, event);
} catch(error) {
// Error: No such interface supported (IE)
element.fireEvent(event.eventType);
}
}
return event;
}
Event.fire('myhidden_element_id', 'custom:change');