maqetta/maqetta — Issue #1601: Questionable loops in Context.js
Author: peller
Created: 2012-01-19 06:13:48+00:00
State: open
Labels: Bug

Two loops are flagged with FIXME comments. The instruction in the loop is invariant. You'd expect it to repeat with the iteration from the array, instead it passes the whole array. Either the recipient of this data expects the array, cancelling out the error, or there's a bug we're not noticing (or the code isn't used?)

First, in Context.loadTheme:
```js

if (theme.files){ // #1024 some themes may not contain files, themeMaps
//FIXME: Brad: this can't be right...
theme.files.forEach(function(){
themeHash[theme.files] = theme;
});
}
```

then in Context.getRelativeMetaTargetSelector:
```js

return target.map(function(){
//FIXME: Brad, is it intentional to add the same thing to the selector array for each element in target?
return theme.metadata.getRelativeStyleSelectorsText(widgetType, state, null, target);
});
```