From 87d6bcec31046d84d1b4518d0888f1715e15e60b Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Fri, 28 Dec 2007 19:08:36 +0000 Subject: [PATCH] Fixes bug with charCode, bad 'var' and missing semicolon --- src/event.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/event.js b/src/event.js index 30f1b03b1..89391d5dd 100644 --- a/src/event.js +++ b/src/event.js @@ -207,7 +207,7 @@ jQuery.event = { // Handle triggering of extra function if ( extra && jQuery.isFunction( extra ) ) { // call the extra function and tack the current return value on the end for possible inspection - var ret = extra.apply( elem, data.concat( val ) ); + ret = extra.apply( elem, data.concat( val ) ); // if anything is returned, give it precedence and have it overwrite the previous value if (ret !== undefined) val = ret; @@ -314,7 +314,7 @@ jQuery.event = { } // Add which for key events - if ( !event.which && (event.charCode || event.keyCode) ) + if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) event.which = event.charCode || event.keyCode; // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) @@ -563,7 +563,7 @@ var withinElement = function(event, elem) { // Check if mouse(over|out) are still within the same parent element var parent = event.relatedTarget; // Traverse up the tree - while ( parent && parent != elem ) try { parent = parent.parentNode } catch(error) { parent = elem; }; + while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; } // Return true if we actually just moused on to a sub-element return parent == elem; };