mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
jquery event: caching the props array and fixing the loop that goes thru it. It was accessing an invalid index.
This commit is contained in:
parent
52fbe5d2a8
commit
abb055bb49
10
src/event.js
10
src/event.js
@ -274,6 +274,8 @@ jQuery.event = {
|
||||
return val;
|
||||
},
|
||||
|
||||
props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" "),
|
||||
|
||||
fix: function(event) {
|
||||
if ( event[expando] == true )
|
||||
return event;
|
||||
@ -282,9 +284,11 @@ jQuery.event = {
|
||||
// and "clone" to set read-only properties
|
||||
var originalEvent = event;
|
||||
event = { originalEvent: originalEvent };
|
||||
var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");
|
||||
for ( var i=props.length; i; i-- )
|
||||
event[ props[i] ] = originalEvent[ props[i] ];
|
||||
|
||||
for ( var i = this.props.length, prop; i; ){
|
||||
prop = this.props[ --i ];
|
||||
event[ prop ] = originalEvent[ prop ];
|
||||
}
|
||||
|
||||
// Mark it as fixed
|
||||
event[expando] = true;
|
||||
|
Loading…
Reference in New Issue
Block a user