Your need sounds reasonable. Just a minor correction (I just removed
the "var deep..." line):
Widget.prototype.getWidgetsByClassName = function(cssName, deep) {
var w;
var ws = [];
for (var i=0; i<this.widgets.length; i++) {
w = this.widgets[i];
if (w.div.className == cssName) ws.push(w);
if (deep)
ws =
ws.concat(w.getWidgetsByClassName(cssName, deep));
}
return ws;
}
I really like the "deep" option. I guess I have to add the "deep"
argument to other similar methods such as "getWidgetById" and
"getWidgetsByType" ;).
Thanks.