Skip to content

Commit 0a213d2

Browse files
committed
Event: reduce size
1 parent 360c512 commit 0a213d2

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/event.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -399,23 +399,21 @@ jQuery.event = {
399399
},
400400

401401
addProp: function( name, hook ) {
402-
var getter = jQuery.isFunction( hook ) ?
403-
function hookGetter() {
404-
if ( this.originalEvent ) {
405-
return hook( this.originalEvent );
406-
}
407-
} :
408-
function propGetter() {
409-
if ( this.originalEvent ) {
410-
return this.originalEvent[ name ];
411-
}
412-
};
413-
414402
Object.defineProperty( jQuery.Event.prototype, name, {
415403
enumerable: true,
416404
configurable: true,
417405

418-
get: getter,
406+
get: jQuery.isFunction( hook ) ?
407+
function() {
408+
if ( this.originalEvent ) {
409+
return hook( this.originalEvent );
410+
}
411+
} :
412+
function() {
413+
if ( this.originalEvent ) {
414+
return this.originalEvent[ name ];
415+
}
416+
},
419417

420418
set: function( value ) {
421419
Object.defineProperty( this, name, {

0 commit comments

Comments
 (0)