Side navigation
#4154 closed bug (invalid)
Opened February 14, 2009 10:21PM UTC
Closed February 20, 2009 12:47AM UTC
Firefox 3 + a lot of (mouseover) events
Reported by: | fmate14 | Owned by: | brandon |
---|---|---|---|
Priority: | major | Milestone: | 1.3.2 |
Component: | event | Version: | 1.3.1 |
Keywords: | mouseover firefox | Cc: | |
Blocked by: | Blocking: |
Description
I try use $('td').mouseover(fn) with a lot of td's. But I can not refresh or leave the page on Firefox 3.0.6, it begins thinking, and thinking, then I must kill the jQuery script.
For example see the attachement file! Sorry the hungarian strings, but just load it into FF 3 and try reload. It thinking a lot before it begins re-loading.
As I see this is maybe because jQuery want unbind the events. But it works well with IE or Opera.
Currently I wrote onmouseover attribute to every <td> (not use jQuery event binding), and it works with FF too.
Attachments (2)
Change History (4)
Changed February 18, 2009 02:18AM UTC by comment:1
resolution: | → worksforme |
---|---|
status: | new → closed |
Changed February 18, 2009 02:21AM UTC by comment:2
I should add that I tried it on a slow XP system with only 384MB RAM, so if there was a problem I'm pretty sure it would show up on this system.
Changed February 18, 2009 07:52AM UTC by comment:3
resolution: | worksforme |
---|---|
status: | closed → reopened |
Dear dmethvin!
I'm in shame. The teszt.zip attachement was wrong, because I send the file I don't want.
I have created a minimal test. It is only 74kb html file. It contains 4,000 <em> tag. With jQuery's mouseover and mouseout events it can not be reloaded with Firefox 3.0.6 (it can be reloaded with IE, Opera, etc), but it works well with HTML's onmouseover and onmouseout events.
Yes, I know 4,000 event is a lot, but in my current work I must use like this. If I must, I can use HTML's events, but as you see, the HTML file will bigger.
Thank you for your works and sorry my english.
Changed February 20, 2009 12:47AM UTC by comment:4
resolution: | → invalid |
---|---|
status: | reopened → closed |
Your English is good, and your new test case is better!
Instead of attaching two handlers for every event, try the jQuery 1.3 event delegation:
$('em').live("mouseover", function(){ $(this).css('background', '#f00') } ); $('em').live("mouseout", function(){ $(this).css('background', '#fff') } );
This worked well with your test case and was very fast. I don't think this is a bug, you just need to be careful about attaching a lot of event handlers.
I tried this with jQuery 1.3.1 and Firefox 3.0.6 and performance is very good, especially considering it's a 1.3MB HTML file! I don't see any long delays on reload.