JQuery.event.fix causes unnecessary reflows in IE when handling key events
|Reported by:||scott_h||Owned by:||dmethvin|
|Keywords:||performance, reflow, 1.7-discuss||Cc:|
Description (last modified by dmethvin)
When normalising the event object, jQuery adds pageX/pageY properties in IE based on a combination of event.clientX/Y and document.body.scrollLeft/Top.
Accessing scrollLeft/Top on the body triggers a full-page reflow. On a large DOM, this makes jQuery's key* event handlers unnecessarily slow in IE7 and IE8, since pageX/Y are useless for key events (and so could be defined without triggering reflows).
Interestingly, I discovered that IE defines clientX/Y on key* events to be the current mouse position, whereas in Safari/Firefox they (along with pageX/Y) are both 0. This inconsistency makes me sure that no one uses jQuery's pageX/Y on key events.
Change History (21)
comment:2 Changed 6 years ago by snover
- Milestone changed from 1.4.3 to 1.next
- Priority set to low
- Status changed from new to open
- Type changed from bug to enhancement
comment:16 Changed 6 years ago by dmethvin
- Description modified (diff)
- Milestone changed from 1.next to 1.7
comment:18 Changed 6 years ago by dmethvin
- Owner set to dmethvin
- Status changed from open to assigned