Support multiple attributes for a single controlled element
Closed this issue · 2 comments
JRJurman commented
Summary
For many inputs, there may be multiple attributes that we'd like to control via host attributes. Sadly though, the current interface for tl-controlled
only allows a single attribute on the target element.
Examples could include wanting to read:
disabled
andvalue
of a text inputindeterminate
andchecked
of a checkbox input
JRJurman commented
One way we could solve this would be having an attrmap
, that maps element attributes to host attributes. E.g.
<input tl-controlled
tl-attrmap="disabled:disabled value:value" />
The syntax here would be "<element-attribute-name>:<host-attribute-name>"
, and could support a space delimited list
JRJurman commented
It is possible that the above interface would be a breaking change, since users can technically set attributes with :
in them (see https://codepen.io/JRJurman/pen/poGoOJK).