Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
IE & relatedTarget again
Browse files Browse the repository at this point in the history
PR #401 was not complete. My intention was to set the relatedTarget
to null if we run into one of these invalid relatedTargets.
  • Loading branch information
arv committed Mar 24, 2014
1 parent 0b57626 commit 0725a1c
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/wrappers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,19 +276,20 @@
// way to have relatedTarget return the adjusted target but worse is that
// the originalEvent might not have a relatedTarget so we hit an assert
// when we try to wrap it.

// In IE we can get objects that are not EventTargets at this point.
// Safari does not have an EventTarget interface so revert to checkin for
// addEventListener as an approximation.

if (unwrappedRelatedTarget && unwrappedRelatedTarget instanceof Object &&
unwrappedRelatedTarget.addEventListener) {
var relatedTarget = wrap(unwrappedRelatedTarget);

var adjusted = adjustRelatedTarget(currentTarget, relatedTarget);
if (adjusted === target)
return true;

if (unwrappedRelatedTarget) {
// In IE we can get objects that are not EventTargets at this point.
// Safari does not have an EventTarget interface so revert to checking
// for addEventListener as an approximation.
if (unwrappedRelatedTarget instanceof Object &&
unwrappedRelatedTarget.addEventListener) {
var relatedTarget = wrap(unwrappedRelatedTarget);

var adjusted = adjustRelatedTarget(currentTarget, relatedTarget);
if (adjusted === target)
return true;
} else {
adjusted = null;
}
relatedTargetTable.set(event, adjusted);
}
}
Expand Down

0 comments on commit 0725a1c

Please sign in to comment.