Skip to content

Commit

Permalink
Fix for #504
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonaaron committed Dec 31, 2006
1 parent 61504d5 commit b06dd43
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/event/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b06dd43

Please sign in to comment.