Did some minor tidying up.

This commit is contained in:
John Resig 2007-06-30 13:57:49 +00:00
parent 62ae0eff50
commit af329ed00b

View file

@ -64,7 +64,7 @@ jQuery.event = {
// And bind the global event handler to the element // And bind the global event handler to the element
if (element.addEventListener) if (element.addEventListener)
element.addEventListener(type, element.$handle, false); element.addEventListener(type, element.$handle, false);
else if (element.attachEvent) else
element.attachEvent("on" + type, element.$handle); element.attachEvent("on" + type, element.$handle);
} }
@ -112,7 +112,7 @@ jQuery.event = {
if ( !ret ) { if ( !ret ) {
if (element.removeEventListener) if (element.removeEventListener)
element.removeEventListener(type, element.$handle, false); element.removeEventListener(type, element.$handle, false);
else if (element.detachEvent) else
element.detachEvent("on" + type, element.$handle); element.detachEvent("on" + type, element.$handle);
ret = null; ret = null;
delete events[type]; delete events[type];
@ -227,8 +227,8 @@ jQuery.event = {
// Calculate pageX/Y if missing and clientX/Y available // Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && event.clientX != null ) { if ( event.pageX == null && event.clientX != null ) {
var e = document.documentElement, b = document.body; var e = document.documentElement, b = document.body;
event.pageX = event.clientX + (e && e.scrollLeft || b && b.scrollLeft); event.pageX = event.clientX + (e && e.scrollLeft || b.scrollLeft);
event.pageY = event.clientY + (e && e.scrollTop || b && b.scrollTop); event.pageY = event.clientY + (e && e.scrollTop || b.scrollTop);
} }
// Add which for key events // Add which for key events
@ -539,10 +539,9 @@ jQuery.fn.extend({
f.apply( document, [jQuery] ); f.apply( document, [jQuery] );
// Otherwise, remember the function for later // Otherwise, remember the function for later
else { else
// Add the function to the wait list // Add the function to the wait list
jQuery.readyList.push( function() { return f.apply(this, [jQuery]) } ); jQuery.readyList.push( function() { return f.apply(this, [jQuery]) } );
}
return this; return this;
} }