Replies: 3 comments 1 reply
-
I believe so, per this thread / answer - #2189 (comment) |
Beta Was this translation helpful? Give feedback.
-
No, it just renders to the shadow root and leaves the element's children alone.
This is expected behavior now. If you want to clear the container you can do so in
What's inconsistent? |
Beta Was this translation helpful? Give feedback.
-
Yeah, you need an unnamed |
Beta Was this translation helpful? Give feedback.
-
Suppose we have a
simple-greeting
Lit component, which outputs "Hello ${name}".Consider the following html markup:
Currently, if the
simple-greeting
component uses shadow DOM, it will clear the inner HTML that it received from the markup, and will render its own output in its place. The result will beHello World
. If, however, the user overrides thecreateRenderRoot
method to avoid the creation of shadow DOM, the component won't clear up the inner HTML, and will render its own content alongside the HTML it received from HTML markup. The result will be:I come from html file. Hello World.
.This wasn't the case in lit-element 2.4 (which cleared the initial inner HTML regardless of whether it was using light DOM or shadow DOM), but is now.
Example in Lit playground
Beta Was this translation helpful? Give feedback.
All reactions