Ticket #6604 (closed defect: fixed)
getDescendants() broken for various layout widgets
| Reported by: | bill | Owned by: | bill |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2 |
| Component: | Dijit | Version: | 1.1.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by bill) (diff)
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.