bigskysoftware / bigskysoftware/htmx
Lit Light DOM Components Are Removed After hx-swap="morph:outerHTML"
- Dominant language
- JavaScript
- Stars
- 49.4k
- Forks
- 1.7k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 30
Description
Hi, I’m using HTMX with morph in my project. I created a custom Lit component using Light DOM by overriding:
```
createRenderRoot() {
return this
}
```
Problem:
When using:
```
hx-swap="outerHTML"
```
everything works fine, and the component keeps its internal DOM structure.
However, when using:
```
hx-swap="morph:outerHTML"
```
the internal DOM disappears. Only the custom element tag remains:
Before swap:
```
...
```
After swap:
```
```
It seems that morph does not preserve the Light DOM children of custom elements, unlike a normal outerHTML swap.
Question:
Is there any configuration or solution to prevent Light DOM children from being removed when using hx-swap="morph:outerHTML" with Lit custom elements?
Contributor guide
Assessment
This issue has not been assessed yet.