Added back in Joern's changes - oops! Let me know if I missed any.

This commit is contained in:
John Resig 2006-12-23 06:17:16 +00:00
parent cc5f46454f
commit 232da5dde0

26
src/jquery/jquery.js vendored
View file

@ -162,6 +162,8 @@ var $ = jQuery;
* technically, chainable - there really isn't much use for chaining against it. * technically, chainable - there really isn't much use for chaining against it.
* You can have as many $(document).ready events on your page as you like. * You can have as many $(document).ready events on your page as you like.
* *
* See ready(Function) for details about the ready event.
*
* @example $(function(){ * @example $(function(){
* // Document is ready * // Document is ready
* }); * });
@ -2100,9 +2102,6 @@ jQuery.extend({
event = jQuery.event.fix( event || window.event || {} ); // Empty object is for triggered events with no data event = jQuery.event.fix( event || window.event || {} ); // Empty object is for triggered events with no data
// If no correct event was found, fail
if ( !event ) return false;
var returnValue = true; var returnValue = true;
var c = this.events[event.type]; var c = this.events[event.type];
@ -2125,20 +2124,19 @@ jQuery.extend({
}, },
fix: function(event) { fix: function(event) {
// check IE // Fix target property, if necessary
if(jQuery.browser.msie) { if ( !event.target && event.srcElement )
// fix target property, if available
// check prevents overwriting of fake target coming from trigger
if(event.srcElement)
event.target = event.srcElement; event.target = event.srcElement;
// calculate pageX/Y // Calculate pageX/Y if missing and clientX/Y available
if ( typeof event.pageX == "undefined" && typeof event.clientX != "undefined" ) {
var e = document.documentElement, b = document.body; var e = document.documentElement, b = document.body;
event.pageX = event.clientX + (e.scrollLeft || b.scrollLeft); event.pageX = event.clientX + (e.scrollLeft || b.scrollLeft);
event.pageY = event.clientY + (e.scrollTop || b.scrollTop); event.pageY = event.clientY + (e.scrollTop || b.scrollTop);
}
// check safari and if target is a textnode // Check safari and if target is a textnode
} else if(jQuery.browser.safari && event.target.nodeType == 3) { if ( jQuery.browser.safari && event.target.nodeType == 3 ) {
// target is readonly, clone the event object // target is readonly, clone the event object
event = jQuery.extend({}, event); event = jQuery.extend({}, event);
// get parentnode from textnode // get parentnode from textnode
@ -2146,15 +2144,17 @@ jQuery.extend({
} }
// fix preventDefault and stopPropagation // fix preventDefault and stopPropagation
if (!event.preventDefault) if (!event.preventDefault) {
event.preventDefault = function() { event.preventDefault = function() {
this.returnValue = false; this.returnValue = false;
}; };
}
if (!event.stopPropagation) if (!event.stopPropagation) {
event.stopPropagation = function() { event.stopPropagation = function() {
this.cancelBubble = true; this.cancelBubble = true;
}; };
}
return event; return event;
} }