Tag Archive for 'Firefox 3'

Safari 3.1 and Prototype conflicts

Apple has shipped the new version of Safari last week, which has enhanced usage of JavaScript. From now on Safari 3.1 natively supports getElementsByClassName, which is good, Safari can process and execute this function even faster than before. The upcoming version of Firefox also implements native support. Good. Performance upgrades are always good, and even more welcome nowadays in our ‘ultra-interactive’ web of 2.0 applications.

But on the other side, this causes issues for Prototype-based websites, there is a conflict between the native and the Prototype methods, which both have the same name.

For example if you are accessing a bunch of elements like this:

$('foo').getElementsByClassName("bar").each(Element.hide);

It will not behave like it did before. Hmm. You do not need to scream and shout now, until the Prototype team comes out with a solution you can still use this syntax:

$$("#foo .bar").each(Element.hide);

Easy, huh? So be aware that your sites may be broken for Safari users and replace the affected lines with the workaround mentioned above.