Replies: 4 comments 1 reply
-
|
Thanks for the suggestion, this is a great idea. Relative targeting is a real need for reusable components, and your We're currently evaluating the best way to implement this natively. We'll keep this discussion updated as we progress. |
Beta Was this translation helpful? Give feedback.
-
|
The evolution is part of the 1.4.8 version. The website has been updated: https://mujs.org/documentation#relative-targets Thanks again for the suggestion! |
Beta Was this translation helpful? Give feedback.
-
|
Great, thanks ! |
Beta Was this translation helpful? Give feedback.
-
|
Sorry! I created the tag, but I forget to create the release in GitHub. It's OK now. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently evaluating µJS as a replacement for HTMX, and so far, it looks promising!
However, I could not find a way to express a target relative to the "trigger node".
HTMX has different options for this (https://htmx.org/attributes/hx-target/). Targeting the trigger node or a child node without generating and tracking an ID is useful for reusable components.
I partially solved this with a hack when building the configuration for the trigger element:
This allows writing selectors like
mu-target="&",mu-target="& > .user-list", andmu-target="& + .dest": the & symbol is replaced with the trigger node ID (self-generated if missing). But may not be robust for each cases.Is it something that is already supposed to work, but I didn't find how?
Or is it something you're considering adding?
Beta Was this translation helpful? Give feedback.
All reactions