You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LitTemplate restrictions on render() not documented, prevents use of several LitElement features #17455
The render() function in a LitElement template can apparently only contain a html template.
This effectively prevents using the LitElement styleMap and classMap features.
Expected behavior
It should be possible to write code like the following, where the call to render re-evaluates what styles and classes are to be applied.
Please document this restriction clearly -- no variables can be computed in render().
For example this restriction prevents constructing a LitElement template in JavaScript by assembling subpieces https://lit.dev/docs/templates/expressions/#templates
Maybe the restriction could be on the elements that need to be visible with @id that need to be at top level so JSoup can see them.
Minimal reproducible example
See above. Add variables before the html backtick.
Versions
Vaadin: 24.1.4
Flow: 24.1.5
Java: JetBrains s.r.o. 17.0.6
OS: amd64 Windows 11 10.0
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.203
changed the title [-]LitTemplate restrictions on render() not documented, prevent use of styleMap and classMap built-ins.[/-][+]LitTemplate restrictions on render() not documented, prevents use of several LitElement features[/+]on Aug 15, 2023
The variables issue is just that it was an use case that was not known at the time and no one has used that so far.
Added a fix pr to support those.
On the templates usage it should be fine as long as the @Id elements are in the main render html.
Activity
[-]LitTemplate restrictions on render() not documented, prevent use of styleMap and classMap built-ins.[/-][+]LitTemplate restrictions on render() not documented, prevents use of several LitElement features[/+]fix: Accept statements before html render
caalador commentedon Aug 16, 2023
The variables issue is just that it was an use case that was not known at the time and no one has used that so far.
Added a fix pr to support those.
On the templates usage it should be fine as long as the
@Idelements are in the main render html.fix: Accept statements before html render (#17457)
fix: Accept statements before html render (#17457)
fix: Accept statements before html render (#17457) (#17469)