Don't fail if target.ownerDocument is null

See f71dbab.
This commit is contained in:
Ben Alpert committed 2014-04-08 14:08:16 -07:00
1 parent 5fa001b12c
commit 4d62e1ef59
1 file changed
+6 -1
@@ -38,7 +38,12 @@ var UIEventInterface = {
return target;
} else {
var doc = target.ownerDocument;
return doc.defaultView || doc.parentWindow;
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
if (doc) {
return doc.defaultView || doc.parentWindow;
} else {
return window;
}
}
}
},