Hopefully fix boolean reflected attributes not properly getting set

The previous way worked eventually, but attributes did not get immediately synced to properties
This commit is contained in:
nathan 2022-06-22 14:25:31 -06:00
parent cbbe8c4400
commit 5b0427fe0c

View File

@ -1416,17 +1416,15 @@ function transformAttributes(widget, mgr : et2_arrayMgr, attributes)
if(widget.getAttributeNames().indexOf(attribute) >= 0 || property.reflect && attrValue)
{
// Set as attribute (reflected in DOM)
widget.setAttribute(attribute, attrValue);
widget.setAttribute(attribute, attrValue === true ? "" : attrValue);
}
else if (attribute === 'options')
else if(attribute === 'options')
{
console.trace('Ignored setting depricated "options" attribute for widget #'+widget.id, widget);
}
else
{
// Set as property, not attribute
widget[attribute] = attrValue;
console.trace('Ignored setting depricated "options" attribute for widget #' + widget.id, widget);
continue;
}
// Set as property
widget[attribute] = attrValue;
}
if(widget_class.getPropertyOptions("value") && widget.set_value)