Skip to content

[4.0.0-alpha7] Allow hx-target in <hx-partial> to swap multiple targets using a .class selector? #3684

@YamiOdymel

Description

@YamiOdymel

I'm sorry for repeatedly posting on this issue, but the documentation is very unclear about whether hx-target supports the .class selector to target multiple elements.

For example, the documentation (both the 2.x and 4.0 versions) explains that you can swap multiple targets within a single response (though I know this is not about hx-target), but it never states whether hx-target must be an #id. This may lead to misunderstanding.

In #3550, it was clarified that the regular hx-target does not support the .class selector. However, I was told that hx-swap-obb does support it. Since <hx-partial> is presented as an alternative to hx-swap-obb, shouldn't hx-target in <hx-partial> also support the .class selector so that multiple targets can be swapped?

But, when I tried hx-swap-obb in 4.0.0-alpha7, it only swapped the first matched .class element: #3683 🫠 (wat)

At this point, the overall situation has become quite confusing for me. Like, are they supported, or are there no plans to support them? If not, I'd like a "CLASS SELECTOR IN hx-target IS NOT SUPPORTED 🫵" in the documentation.

Also, feel free to close any of my issues if they are not relevant, sorry for keep spamming it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions