Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#18851 closed defect (fixed)

Bug found in dijit.Tree. Error occurs when deleting a mouse focused tree node.

Reported by: qzhong Owned by: bill
Priority: undecided Milestone: 1.10.7
Component: Dijit Version: 1.11.1
Keywords: Cc:
Blocked By: Blocking:

Description

To reproduce the bug in dojo test page:

  1. Copy the attached file test_TreeDeleteBug.html into dijit/tests/tree
  2. Load it up in browser
  3. Select "United States of America" node in the third tree
  4. Click "delete item of USA" button on the buttom

Observed: console error: Failed to execute 'contains' on 'Node': parameter 1 is not of type 'Node'.

After debugging on the dojo source, we found that dom.isDescendant is passing a wrong parameter: dom.isDescendant(tree.lastFocusedChild.domNode, tree.domNode). Here "tree.lastFocusedChild" is a widget, but dom.isDescendant is expecting 2 nodes. The error occurs in dom.js line 104. The problem got solved after manually passing domNode of the widget: dom.isDescendant (tree.lastFocusedChild.domNode, tree.domNode). Also the problem does manifest in the D.O.H test cases: test case "nestItemDelete" failed with the same error.

Attachments (1)

test_TreeDeleteBug.html (7.8 KB) - added by qzhong 4 years ago.
Bug testing page

Download all attachments as: .zip

Change History (10)

Changed 4 years ago by qzhong

Attachment: test_TreeDeleteBug.html added

Bug testing page

comment:1 Changed 4 years ago by bill

After debugging on the dojo source, we found that dom.isDescendant is passing a wrong parameter: dom.isDescendant(tree.lastFocusedChild.domNode, tree.domNode). Here "tree.lastFocusedChild" is a widget, but dom.isDescendant is expecting 2 nodes.

Did you make a typo in your description? I don't see any code like that in Tree.js, and furthermore, if tree.lastFocusedChild is a widget, then tree.lastFocusedChild.domNode is a node, so therefore dom.isDescendant() will receive two nodes.

comment:2 Changed 4 years ago by qzhong

tree.lastFocusedChild.domNode is a node, the code before correction it doesn't have ".domNode". dom.isDescendant() receives one widget and one node.

In the dojo source code( not the built version), go to Tree.js,functions _onItemDelete and setChildItems passed widgets to dom.isDescendant().

line 417: if(tree.lastFocusedChild && !dom.isDescendant(tree.lastFocusedChild, tree.domNode)){

line 420: if(focusedChild && !dom.isDescendant(focusedChild, tree.domNode)){

line 1650: if(this.lastFocusedChild && !dom.isDescendant(this.lastFocusedChild, this.domNode)){

line 1653: if(this.focusedChild && !dom.isDescendant(this.focusedChild, this.domNode)){

comment:3 Changed 4 years ago by bill

Ah I see. Sorry, I confused myself by accidentally looking at an old version of the Tree code. [Some of] the misbehaving code came from #6236 in 1.10.

comment:4 Changed 3 years ago by dylan

Milestone: tbd1.11.3

comment:5 Changed 3 years ago by Denis Rykov

Came across the same issue here.

comment:6 Changed 3 years ago by Bill Keese <bill@…>

Resolution: fixed
Status: newclosed

In fb8e1093/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:7 Changed 3 years ago by Bill Keese <bill@…>

In b87bfbe/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:8 Changed 3 years ago by Bill Keese <bill@…>

In f35a55a/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:9 Changed 3 years ago by bill

Milestone: 1.11.31.10.7
Note: See TracTickets for help on using tickets.