Opened 12 years ago

Closed 12 years ago

#2906 closed defect (fixed)

Exception in dojo.dom.isDescendantOf

Reported by: guest Owned by: alex
Priority: high Milestone: 0.9
Component: HTML Version: 0.4.2
Keywords: Cc:
Blocked By: Blocking:

Description

Due to a bug in firefox (see https://bugzilla.mozilla.org/show_bug.cgi?id=208427) accessing properties of event.relatedTarget or .originalTarget -- when it is an input element that's inside of a div -- causes an exception "Permission denied to get property HTMLDivElement.parentNode" to be thrown.

I suggest patching it thusly: while(node) {

if(node == ancestor){

return true; boolean

} try {

node = node.parentNode;

} catch (e) {

return true;

}

}

Because the error only(?) occurs during event handling when the input element was the source of the event it almost always is a descendant of the element whose event handler is calling isDescendantOf, hence returning true. Its not perfect, but its better then FF throwing an exception.

Change History (2)

comment:1 Changed 12 years ago by bill

Component: DOMHTML
Milestone: 0.9
Owner: changed from anonymous to alex

To get Tooltip to work correctly I had to make the try return false (see [8835]). Firebug is claiming that the div is inside the <input>, not vice-versa, but getting the parentNode causes and exception. Leaving this bug open because we've agreed to port isAncestor() to core and this is related. Refs #2804.

comment:2 Changed 12 years ago by Adam Peller

Resolution: fixed
Status: newclosed

The port includes the try/catch and return false. There's no test case, so I'm closing this ticket. Please re-open if any related problems come up.

Note: See TracTickets for help on using tickets.