Handle width attribute from template as special case

Should still be avoided
This commit is contained in:
nathan 2022-07-19 16:20:49 -06:00
parent 1cc63b69ca
commit 4b52b62698

View File

@ -1344,6 +1344,16 @@ function transformAttributes(widget, mgr : et2_arrayMgr, attributes)
{ {
const widget_class = window.customElements.get(widget.localName); const widget_class = window.customElements.get(widget.localName);
// Special case attributes
if(attributes.width)
{
widget.style.setProperty("width", attributes.width);
widget.style.setProperty("flex", "0 0 auto");
delete attributes.width;
console.log("Widget sets width via attribute. We want to avoid this - use CSS instead.", widget);
}
// Apply any set attributes - widget will do its own coercion // Apply any set attributes - widget will do its own coercion
for(let attribute in attributes) for(let attribute in attributes)
{ {