From 4b52b62698f0c0e8986962c6367030a5a8d17072 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 19 Jul 2022 16:20:49 -0600 Subject: [PATCH] Handle width attribute from template as special case Should still be avoided --- api/js/etemplate/Et2Widget/Et2Widget.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/js/etemplate/Et2Widget/Et2Widget.ts b/api/js/etemplate/Et2Widget/Et2Widget.ts index 540d765680..bab36245ec 100644 --- a/api/js/etemplate/Et2Widget/Et2Widget.ts +++ b/api/js/etemplate/Et2Widget/Et2Widget.ts @@ -1344,6 +1344,16 @@ function transformAttributes(widget, mgr : et2_arrayMgr, attributes) { 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 for(let attribute in attributes) {