Thursday, November 12, 2009

Prototypejs 1.6 clash with JSON !!

Prototypejs 1.6 could break your JSON API usage, be careful !

This article could be a time-saver, prototype.js breaks Firefox 3.5 native JSON

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:
fire: function(element, eventName, memo) {
// ...
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;
}
Example:
Event.fire('myhidden_element_id', 'custom:change');

This page is powered by Blogger. Isn't yours?