Skip to content

Commit

Permalink
Fix Undefined ownerDocument Fatal in IE8
Browse files Browse the repository at this point in the history
This fixes a JS fatal in IE8 when `topLevelTarget.ownerDocument` is sometimes undefined.
  • Loading branch information
yungsters authored and zpao committed Jan 11, 2014
1 parent 73d9d28 commit f71dbab
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/eventPlugins/EnterLeaveEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,17 @@ var EnterLeaveEventPlugin = {
}

var win;
if (topLevelTarget != null && topLevelTarget.window === topLevelTarget) {
// topLevelTarget probably is a window object
if (topLevelTarget.window === topLevelTarget) {
// `topLevelTarget` is probably a window object.
win = topLevelTarget;
} else {
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
var doc = topLevelTarget.ownerDocument;
win = doc.defaultView || doc.parentWindow;
if (doc) {
win = doc.defaultView || doc.parentWindow;
} else {
win = window;
}
}

var from, to;
Expand Down

0 comments on commit f71dbab

Please sign in to comment.