为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Why does Firefox 12 seem to run javascript so slowly?

  • 6 个回答
  • 14 人有此问题
  • 3 次查看
  • 最后回复者为 smisonline2

more options

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

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)

more options

Any chance you can post a code snippet?

more options

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于修改

more options

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.

more options

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.

more options

FF 13 just came out this week. Does it have the same issue?

more options

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.