Skip to content
Browse files

Rename jQuery.event.propHooks to .fixHooks.

We already have jQuery.propHooks for the .prop() method, so using the same name for unrelated functionality on a sub-namespace is crazy talk. Since the method involved is jQuery.event.fix(), this will hopefully tie them together. Oh, and it's shorter.
  • Loading branch information...
1 parent 30cc7ae commit e5b16e3356358a17c54c647b129e44cb09076ec8 @dmethvin dmethvin committed Oct 5, 2011
Showing with 12 additions and 18 deletions.
  1. +6 −6 src/event.js
  2. +6 −12 test/unit/event.js
View
12 src/event.js
@@ -469,7 +469,7 @@ jQuery.event = {
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
- propHooks: {},
+ fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
@@ -523,8 +523,8 @@ 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;
+ fixHook = jQuery.event.fixHooks[ event.type ] || {},
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
@rwaldron
jQuery Foundation member
rwaldron added a note Oct 6, 2011

copy = fixHook too much space between = f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
event = jQuery.Event( originalEvent );
@@ -548,7 +548,7 @@ jQuery.event = {
event.metaKey = event.ctrlKey;
}
- return propHook.filter? propHook.filter( event, originalEvent ) : event;
+ return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
},
// Deprecated, use jQuery.guid instead
@@ -1058,11 +1058,11 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
}
if ( rkeyEvent.test( name ) ) {
- jQuery.event.propHooks[ name ] = jQuery.event.keyHooks;
+ jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
}
if ( rmouseEvent.test( name ) ) {
- jQuery.event.propHooks[ name ] = jQuery.event.mouseHooks;
+ jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
}
});
View
18 test/unit/event.js
@@ -2386,26 +2386,20 @@ test("delegated events quickIs", function() {
markup.remove();
});
-test("propHooks extensions", function() {
+test("fixHooks extensions", function() {
expect( 2 );
// IE requires focusable elements to be visible, so append to body
var $fixture = jQuery( "<input type='text' id='hook-fixture' />" ).appendTo( "body" ),
- saved = jQuery.event.propHooks.click;
+ saved = jQuery.event.fixHooks.click;
// Ensure the property doesn't exist
$fixture.bind( "click", function( event ) {
ok( !("blurrinessLevel" in event), "event.blurrinessLevel does not exist" );
})[0].click();
+ $fixture.unbind( "click" );
- // Must blur the link so click works below
- $fixture.unbind( "click" )[0].blur();
-
- // Define a custom property for "click" events via the filter function
- //ok( !jQuery.event.propHooks.click, "We aren't clobbering an existing click hook" );
-
-
- jQuery.event.propHooks.click = {
+ jQuery.event.fixHooks.click = {
filter: function( event, originalEvent ) {
event.blurrinessLevel = 42;
return event;
@@ -2417,9 +2411,9 @@ test("propHooks extensions", function() {
equals( event.blurrinessLevel, 42, "event.blurrinessLevel was set" );
})[0].click();
- delete jQuery.event.propHooks.click;
+ delete jQuery.event.fixHooks.click;
$fixture.unbind( "click" ).remove();
- jQuery.event.propHooks.click = saved;
+ jQuery.event.fixHooks.click = saved;
});
(function(){

0 comments on commit e5b16e3

Please sign in to comment.
Something went wrong with that request. Please try again.