let x-if add multiple root nodes #2052
TomorrowToday
started this conversation in
3. Feature Ideas
Replies: 1 comment 2 replies
-
I believe the current behaviour is mainly for 2 reasons:
None of them is a real blocker for V3, though. Theoretically, you can also implement your own directive supporting multiple children for your own projects (you just need a good name, maybe x-when). |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It'd be nice to no longer need shim elements or a lot of code duplication to bring in multiple sibling nodes with an x-if template element. The following is a somewhat common scenario: a view selector within a page with computationally heavy styles and scripts that we don't want running when the view isn't loaded. It could be this easy:
If this example were possible it'd be much easier to manipulate layers (z-index) for lightbox effects or style div.view using a grid. Where using a shim element throws off the hierarchy or requires much more html to be duplicated inside the template or the use of many more templates like so:
All the additional lines and duplicated code just makes things brittle and more error prone.
Beta Was this translation helpful? Give feedback.
All reactions