Skip to content

hx-swap-oob="textContent" falling back to the default htmx.config.defaultSwapStyle value #3563

@Norris1z

Description

@Norris1z

Given the HTML:

<div class="items">
...
</div>
<div id="alerts"></div>

Response from server:

<div id="alerts" hx-swap-oob="textContent">
  <h1>Alert</h1>
</div>

According to the documentation, the hx-swap-oob value can be any valid hx-swap value, hence one would expect textContent to work as it does in swap, however, that's not the case.

Looking at https://github.com/bigskysoftware/htmx/blob/master/src/htmx.js#L1800, the switch case does not include textContent, hence it defaults to calling swapWithStyle(htmx.config.defaultSwapStyle, elt, target, fragment, settleInfo).

I'm quite new to this project so i'm not sure if that's the intended behavior and the documentation has to be updated or if it's a bug.

I can submit a PR if this is a bug!

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