possible x-text/x-html enhancement? #4116
Replies: 2 comments 1 reply
-
It's not immediate because alpine uses the real html not a virtual DOM. |
Beta Was this translation helpful? Give feedback.
-
ok.. makes sense.. I also just realised that my "templating solution" comment is probably more relevant that I had first thought.. I ended up just implementing a series of "template" functions in the x-data component that simply return the appropriate template strings to x-text with the substitutions already included.. |
Beta Was this translation helpful? Give feedback.
-
Would it be possible to extend the x-text and x-html attributes to work on the block of text within an element rather than just the attribute value? Perhaps by assuming (or enforcing) a string template if the attribute is valueless?
eg.. instead of
do..
or.. i suppose
I know I can insert a string template into the attribute value now, but that gets unwieldy with longer blocks of text, and the trade off of lots of sub elements with x-texts all the way down gets messy too..
I'm sure there are arguments that this isn't the intended usecase, and that such data manipulation is better handled by some sort of templating solution, but that second snippet above just feels cleaner, so thought it was worth the thought bubble??
Beta Was this translation helpful? Give feedback.
All reactions