mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fix preventDefault for all browsers
This commit is contained in:
parent
c6860d55d4
commit
83b0e17f3f
13
src/jquery/jquery.js
vendored
13
src/jquery/jquery.js
vendored
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user