aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/event.js
diff options
context:
space:
mode:
authorBrandon Aaron <brandon.aaron@gmail.com>2006-12-31 22:03:34 +0000
committerBrandon Aaron <brandon.aaron@gmail.com>2006-12-31 22:03:34 +0000
commitb06dd433b2d77e902c3f643cf791d2a10f63cea6 (patch)
tree6c792cf91bbee1c3bb81f397cedddf55ea43adb2 /src/event/event.js
parent61504d516abcc7bae036056853f21601ad310826 (diff)
downloadjquery-b06dd433b2d77e902c3f643cf791d2a10f63cea6.tar.gz
jquery-b06dd433b2d77e902c3f643cf791d2a10f63cea6.zip
Fix for #504
Diffstat (limited to 'src/event/event.js')
-rw-r--r--src/event/event.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/event/event.js b/src/event/event.js
index 02f3f8198..569a4d0ab 100644
--- a/src/event/event.js
+++ b/src/event/event.js
@@ -134,12 +134,22 @@ jQuery.event = {
event.pageY = event.clientY + (e.scrollTop || b.scrollTop);
}
- // Check safari and if target is a textnode
- if ( jQuery.browser.safari && event.target.nodeType == 3 ) {
- // target is readonly, clone the event object
- event = jQuery.extend({}, event);
+ // check if target is a textnode (safari)
+ if (event.target.nodeType == 3) {
+ // store a copy of the original event object and clone because target is read only
+ var originalEvent = event;
+ event = jQuery.extend({}, originalEvent);
+
// get parentnode from textnode
- event.target = event.target.parentNode;
+ event.target = originalEvent.target.parentNode;
+
+ // add preventDefault and stopPropagation since they will not work on the clone
+ event.preventDefault = function() {
+ return originalEvent.preventDefault();
+ };
+ event.stopPropagation = function() {
+ return originalEvent.stopPropagation();
+ };
}
// fix preventDefault and stopPropagation