Fix preventDefault for all browsers

This commit is contained in:
Jörn Zaefferer 2006-10-27 10:49:18 +00:00
parent c6860d55d4
commit 83b0e17f3f

13
src/jquery/jquery.js vendored
View File

@ -2299,12 +2299,6 @@ jQuery.extend({
if(jQuery.browser.msie) { if(jQuery.browser.msie) {
// get real event from window.event // get real event from window.event
event = window.event; event = window.event;
event.preventDefault = function() {
this.returnValue = false;
};
event.stopPropagation = function() {
this.cancelBubble = true;
};
// fix target property // fix target property
event.target = event.srcElement; event.target = event.srcElement;
// check safari and if target is a textnode // check safari and if target is a textnode
@ -2314,6 +2308,13 @@ jQuery.extend({
// get parentnode from textnode // get parentnode from textnode
event.target = event.target.parentNode; event.target = event.target.parentNode;
} }
// fix preventDefault and stopPropagation
event.preventDefault = function() {
this.returnValue = false;
};
event.stopPropagation = function() {
this.cancelBubble = true;
};
return event; return event;
} }