Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websocket no oob swap occurs when sending full html file over websocket #62

Open
a-alhusaini opened this issue Jul 25, 2024 · 1 comment

Comments

@a-alhusaini
Copy link

If I send this through the websocket

<div id="someid">
  <h1>some heading</heading
  </div>

it swaps properly.

But when I send a full html page over websocket the swap doesn't work.

e.g: if I were to send this instead of the above.. no swap would occure

<DOCTYPE html>
<head stuff>
</head>
<body>
...

No swap occurs.

@hosamhamdy258
Copy link

from docs : hx-swap-oob

Consider the following response HTML:

<div>
 ...
</div>
<div id="alerts" hx-swap-oob="true">
    Saved!
</div>

The first div will be swapped into the target the usual manner. The second div, however, will be swapped in as a replacement for the element with the id alerts, and will not end up in the target.

as you mentioned this part swaps correctly as is parent element and has id attr

<div id="someid">
  <h1>some heading</heading
  </div>

but in 2nd example

<DOCTYPE html>
<head stuff>
</head>
<body>
...

i see you're sending element without id attr regardless of it's html tag still it's noting to match element for
i hope you understand my point correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants