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 )
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 (22)
comment:2 Changed 7 years ago by
|Milestone:||1.4.3 → 1.next|
|Status:||new → open|
|Type:||bug → enhancement|