// Firefox sometimes assigns relatedTarget a XUL element
// which we cannot access the parentNode property of
try {
// Firefox sometimes assigns relatedTarget a XUL element
// which we cannot access the parentNode property of
try {
+
+ // Chrome does something similar, the parentNode property
+ // can be accessed but is null.
+ if ( parent !== document && !parent.parentNode ) {
+ return;
+ }
// Traverse up the tree
while ( parent && parent !== this ) {
parent = parent.parentNode;
// Traverse up the tree
while ( parent && parent !== this ) {
parent = parent.parentNode;