Opened 13 years ago

Last modified 13 years ago

#6604 closed defect

getDescendants() broken for various layout widgets — at Version 1

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.
  if(this.containerNode){
   var list= dojo.query('[widgetId]', this.containerNode);
   return list.map(dijit.byNode);  // Array
  }else{
   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():

if(!this.containerNode){
   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 (1)

comment:1 Changed 13 years ago by bill

Description: modified (diff)
Note: See TracTickets for help on using tickets.