Fixes bug with charCode, bad 'var' and missing semicolon

This commit is contained in:
Yehuda Katz 2007-12-28 19:08:36 +00:00
parent 05930c5a0d
commit 87d6bcec31

View File

@ -207,7 +207,7 @@ jQuery.event = {
// Handle triggering of extra function // Handle triggering of extra function
if ( extra && jQuery.isFunction( extra ) ) { if ( extra && jQuery.isFunction( extra ) ) {
// call the extra function and tack the current return value on the end for possible inspection // 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 anything is returned, give it precedence and have it overwrite the previous value
if (ret !== undefined) if (ret !== undefined)
val = ret; val = ret;
@ -314,7 +314,7 @@ jQuery.event = {
} }
// Add which for key events // 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; event.which = event.charCode || event.keyCode;
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) // 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 // Check if mouse(over|out) are still within the same parent element
var parent = event.relatedTarget; var parent = event.relatedTarget;
// Traverse up the tree // 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 true if we actually just moused on to a sub-element
return parent == elem; return parent == elem;
}; };