maqetta/maqetta — Issue #1804: Need better code for stripping out event attrs
Author: jhpedemonte
Created: 2012-02-23 01:15:47+00:00
State: open
Labels: Priority Low

I don't like this code in **widget.js**:

```javascript

// Strip out event attributes. We want them in the model
// but not in the DOM within page canvas.
var props = {};
for(var p in data.properties){
// The "if(propval" check will be false for empty strings.
// We are therefore stripping out properties with empty string values
// to match similar check in widget.setProperties
var propval = data.properties[p];
if((propval || typeof propval == "boolean") && p.substr(0,2).toLowerCase()!="on"){
props[p] = propval;
}
}
```

That string compare to `"on"` seems fragile. What if a widget has a boolean property called `onlyOnce`?