diff options
author | jeresig <jeresig@gmail.com> | 2011-04-10 16:28:15 -0400 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2011-04-10 16:28:15 -0400 |
commit | 2c74ee46ee6c9a08fb42e105281f59c582a26e7d (patch) | |
tree | 9a506bb5dc1196bff66db49c36dc96758b7ebaf7 /src/event.js | |
parent | 7fb95ebe8f1b79220947d127a5d2b8bf56143622 (diff) | |
parent | 92a4d59c3221ada339177ca860570893766a6429 (diff) | |
download | jquery-2c74ee46ee6c9a08fb42e105281f59c582a26e7d.tar.gz jquery-2c74ee46ee6c9a08fb42e105281f59c582a26e7d.zip |
Merge branch 'eventprops.1.6final' of https://github.com/rwldrn/jquery into rwldrn-eventprops.1.6final
Conflicts:
test/unit/event.js
Diffstat (limited to 'src/event.js')
-rw-r--r-- | src/event.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/event.js b/src/event.js index 788bb20eb..a4f02a7a0 100644 --- a/src/event.js +++ b/src/event.js @@ -1,6 +1,7 @@ (function( jQuery ) { -var rnamespaces = /\.(.*)$/, +var hasOwn = Object.prototype.hasOwnProperty, + rnamespaces = /\.(.*)$/, rformElems = /^(?:textarea|input|select)$/i, rperiod = /\./g, rspace = / /g, @@ -563,7 +564,15 @@ jQuery.Event = function( src ) { // Event object if ( src && src.type ) { this.originalEvent = src; - this.type = src.type; + + // Push explicitly provided properties onto the event object + for ( var prop in src ) { + // Ensure we don't clobber jQuery.Event prototype + // with own properties. + if ( hasOwn.call( src, prop ) ) { + this[ prop ] = src[ prop ]; + } + } // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. @@ -852,10 +861,10 @@ function trigger( type, elem, args ) { // Create "bubbling" focus and blur events if ( !jQuery.support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - + // Attach a single capturing handler while someone wants focusin/focusout var attaches = 0; - + jQuery.event.special[ fix ] = { setup: function() { if ( attaches++ === 0 ) { @@ -1168,3 +1177,4 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl }); })( jQuery ); + |