Why does Firefox 12 seem to run javascript so slowly?
I'm a UI developer and use Firefox daily for development. I've recently put together a page that has a simple toggle (open/close) JavaScript function on about 50 rows in a table. When Row A is clicked, it finds rows that have the same class and shows or hides them depending on their current status. Not brain surgery. The problem seems to be, when I click too quickly on more than 1 row, Firefox hangs and none of the rows work. It's very confusing for the user. I've written this function in several different ways, using a for loop, passing objects from the click function and even using jQuery's toggle function. Nothing seems to solve the problem. Could this be a bug in Firefox 12? All other browsers seem to work just fine, including IE6, 7, 8, 9, Google Chrome and Safari.
I'm sorry I can't post the url as it is a web application that contains sensitive data.
Thanks
เปลี่ยนแปลงโดย kenglover เมื่อ
การตอบกลับทั้งหมด (6)
Any chance you can post a code snippet?
Below is the function that is called upon click. Basically, it gathers the 2 or 3 rows that exist with the className "row"+clickedRowClassName, loops through and checks to see if the class "ExBreakdown-open" is present. If it is, it removes that class, if it is not, it applies the class. The class itself only contains "display:none".
function toggle(ids, el, imgs, row){ var subRows = YAHOO.util.Dom.getElementsByClassName('row'+row, 'tr'); for(i=0; i<subRows.length; i++){ if(YAHOO.util.Dom.hasClass(subRows[i], 'ExBreakdown-open')){ YAHOO.util.Dom.removeClass(subRows[i], 'ExBreakdown-open'); document.getElementById(imgs).src = "/eri/images/open.png"; }else{ YAHOO.util.Dom.addClass(subRows[i], 'ExBreakdown-open'); document.getElementById(imgs).src = "/eri/images/close.png"; } } }
As I said in my original post, the odd thing is that all other browsers seem to have no problems with this function, I've re-written in several different ways and Firefox 12 always seems to have the same problem. Very slow javascript reaction time. Honestly, this isn't the first time I've seen it, but it's the most noticeable to the user.
Thanks in advance for your help.
เปลี่ยนแปลงโดย cor-el เมื่อ
kenglover, yeah nothing there looks like it should be causing problems in Firefox. Do you have addons installed in your Firefox? Sometimes those can slow things down.
I really don't know what to say. A click handler with that simple toggle doesn't seem like it is what is slowing down Firefox. There must be something else causing this.
I totally agree with you, and after a couple weeks of looking for an answer I have to say the only conclusion I've come up with is that there may be some sort of bug in FF 12. Not sure what else it could be. I do have some addons installed on my version of FF 12, but I've tested on other "clean" installs on testing machines and have run into the same issue. It's noticeable on all installs of firefox 12.
Even stranger; When I tested on FF 3.6.27 it seems to work fine.
FF 13 just came out this week. Does it have the same issue?
Yes, i have a bigger Javascript App and it runs very fast and smooth under chrome and other browsers, but under firefox the widgets slow.