Custom Element MutationObserver
See original GitHub issueI am not sure if this is related to uhtml or I am doing someting wrong. I am trying to attach a MutationObserver to a Custom Element with shadow DOM and watch for changes in the template (outside shadow DOM, not sure what the name is for this).
html`
<custom-element>${someValue}</custom-element>
`
I am looking to catch re-render event and apply content changes to my shadow DOM.
I am attaching [non-]working pen to illustrate my issue: https://codepen.io/lemmonjuice/pen/rNMxxOw
When re-rendering the template nothing happens. However if I access the element directly and either change the textContent value or append a child the observer gets triggered. I was expecting that the re-render will trigger the observer as well. Checking the browser inspector I am seeing that the contetn was in fact updated properly.
Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
You need childList too
Okay, I guess I have figured it out. I need to pass combination of options:
Thank you!