Prototype.js Effects May Fail in New Firefox 2.0.0.6

<Update> Please, excuse me for too much buzz. The problem was actually with changes in CCS I made. at the same time as I updated Firefox. I couldn't even imagine that problem could be caused by that, as i just added a couple classes that DO NOT interfere with damaged page in any way. I was mad when I found it.

The CSS provided by some designer I don't know (my cliend hired him to make layout, and I received ready-made layout from my client) and he's a damn lucky guy. Sometimes I want to kill all the lame coders. The only thing that stops me is upderstanding that I also do lame things more or less frequently.

I am very thankful for feedback provided by everyone who commented this article and especially to jQuery developer Rey Bango who contacted me directly. Sorry again for misspelling your name, Rey!

The original article follows. </Update>

There is a feature in called Spy at one of my sites. It was inspired by digg's spy and, in fact, I borrowed some code from there.

TorrentMan Spy was introduced more that a year ago and worked nearly flawlessly until now. Two days ago everything was fine, but today my client reported a bug at that page: instead of moving “endless tape” of items the items just desappeared one by one untill the page was empty. Firebug shown a lot of errors around the line 1300 of prototype.js, mostly too much recursion at 1294.

My first reaction was: “Who is that son of a bitch who made changes to production scripts behind my back?”. Then I saw all the related files intact since last summer and reminded that I've updated Firefox to 2.0.0.6 just yesterday. And so did my client.

A few breakpoints helped me to locate the root of all evil. I have a code like that to make new item appear at the top of the list:

newItem.style.display =  'none';
spytable.insertBefore(newItem, oldItem);
new Effect.Appear(newItem);

Stepping in i finally came to that to much recursion error at line 1294.

I'm unsure yet if it's a bug or a feature, and if it's a bug I don't know yet if it's my bug or prototype.is'. I suspect it could be my bug, as I'm not a big JS Guru, and digg spy still works flawlessly, though it uses older prototype.js and FadeIn effect instead of appear. I had to turn eye-candy off until I fix it.

If it's really a prototype.js bug, I'll file a bug report and write more here.

Check your javascript, don't leave your users one-to-one with broken pages.

Aug. 02, 2007 // 17:51 | Comments (7)