My Dojo app contains several widgets, which are all auto-registered in dijit.registry (an instance of dijit.WidgetSet). I would like to make use of the filter() (Link) or map() (Link) method to apply global changes to certain widgets filtered by a custom property pattern defined in the methods’ callback functions.
Dumping the registry by console.log(dijit.registry); proves that it is filled with widgets:

Just to test the filter() method I did the following (exactly in the same scope as the above mentioned console.log(dijit.registry);):
var widgets = dijit.registry.filter(function(w, i) {
return true;
});
console.log(widgets);
But I got the following output:

Similar behaviour when using the map() method:
var widgets = dijit.registry.map(function(w) {
return w;
});
console.log(widgets);
… I get an empty array then.
What’s going on here, what went wrong?
FYI: Making single console.log(w); inside the callback functions doesn’t output anything, they even aren’t invoked, meaning that dijit.registry isn’t even being iterated by the two methods.
console.log(dijit.registry._hash); prints the object containing 12 properties (widgets). for(var w in dijit.registry._hash) { /* ... */ } doesn’t work at all – it misteriously doesn’t jump into the loop.
The snippet
wasn’t called inside a
dojo.addOnLoad(function() { /* ... */ });, which led to the case created widgets weren’t registered yet and couldn’t be iterated viadijit.registry.filter().