diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2011-09-25 22:04:52 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2011-09-25 22:04:52 -0400 |
commit | c7838c3607239b0231128b270762609703ae3893 (patch) | |
tree | 52fb9b239163887e15c056b0914cc76d8a597a83 | |
parent | b4120a74306e1d98e212c77e5a89c1526a51fc3b (diff) | |
download | jquery-c7838c3607239b0231128b270762609703ae3893.tar.gz jquery-c7838c3607239b0231128b270762609703ae3893.zip |
Minor cleanups to code. Futile effort to get IE to pass the unit test.
-rw-r--r-- | src/event.js | 9 | ||||
-rw-r--r-- | test/unit/event.js | 5 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/event.js b/src/event.js index 00b332c5b..9ad8d69b7 100644 --- a/src/event.js +++ b/src/event.js @@ -488,7 +488,8 @@ jQuery.event = { props: "button buttons clientX clientY fromElement layerX layerY offsetX offsetY pageX pageY screenX screenY toElement wheelDelta".split(" "), filter: function( event, original ) { var eventDoc, doc, body, - button = original.button; + button = original.button, + fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { @@ -501,8 +502,8 @@ jQuery.event = { } // Add relatedTarget, if necessary - if ( !event.relatedTarget && original.fromElement ) { - event.relatedTarget = original.fromElement === event.target ? original.toElement : original.fromElement; + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right @@ -523,7 +524,7 @@ jQuery.event = { // Create a writable copy of the event object and normalize some properties var originalEvent = event, propHook = jQuery.event.propHooks[ event.type ] || {}, - copy = propHook.props? this.props.concat( propHook.props ) : this.props; + copy = propHook.props ? this.props.concat( propHook.props ) : this.props; event = jQuery.Event( originalEvent ); diff --git a/test/unit/event.js b/test/unit/event.js index 319569ab9..1ca3e7d78 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2386,9 +2386,8 @@ test("delegated events quickIs", function() { test("propHooks extensions", function() { expect( 3 ); - jQuery( "<a id='hook-fixture' href=''></a>" ).appendTo( "#qunit-fixture" ); - - var $fixture = jQuery( "#hook-fixture" ); + // IE requires focusable elements to be visible, so append to body + var $fixture = jQuery( "<input type='text' id='hook-fixture' />" ).appendTo( "body" ); // Ensure the property doesn't exist $fixture.bind( "focus", function( event ) { |