Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#6604 closed defect (fixed)

getDescendants() broken for various layout widgets

Reported by: bill Owned by: bill
Priority: high Milestone: 1.2
Component: Dijit Version: 1.1.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

This is fallout from #5865.

In Dojo 1.1, _Widget.getDescendats() searches widgets off "containerNode", which did under "domNode" in 1.0.

 getDescendants: function(){
  // summary:
  // Returns all the widgets that contained by this, i.e., all
widgets underneath this.containerNode.
   var list= dojo.query('[widgetId]', this.containerNode);
   return;  // Array
   return [];

This change causes destroyDescendants() not working for some layout widgets, as they do not set "containerNode"...

While, _Container.getChildren() still does access domNode:

 getChildren: function(){
  // summary:
  //  Returns array of children widgets
  return dojo.query("> [widgetId]", this.containerNode || this.domNode).map(dijit.byNode); // Array

Maybe can add this to _Container.postCreate():

   this.containerNode = this.domNode;

and then modify getChildren() and friends to use this.containerNode exclusively.

Note that getDescendants()/destroyDescendants() on a plain widget with widgets in it's template but no true descendants should do nothing; need to make sure that the widgets in the template aren't destroyed in that case either.

Change History (4)

comment:1 Changed 14 years ago by bill

Description: modified (diff)

comment:2 Changed 14 years ago by bill

Resolution: fixed
Status: newclosed

(In [13521]) Fix leak where destroyDescendants() wasn't working on layout widgets.

Problem was that getDescendants() wasn't finding the children (and grandchildren, etc) of widgets which didn't set containerNode, particularly layout widgets with no templates.

Fixes #6604. !strict

comment:3 Changed 14 years ago by bill

(In [13537]) Fix bug where closing a tree node would hide the node itself rather than just it's children; regression from [13521].

TreeNode? is unusual in that it defines containerNode lazily, so the code in _Container to set containerNode automatically was actually messing things up.

Fixes #6673, refs #6604. !strict

comment:4 Changed 14 years ago by bill

(In [13568]) Avoid null reference. Refs #6673, #6604. !strict

Note: See TracTickets for help on using tickets.