3 ms·
Is it possible to nest custom elements? I suppose it should be, but how would it be seen in DOM? <my-container> <some-child some-attr></some-child> </my-cont
by megous 9y ago
Is it possible to nest custom elements? I suppose it should be, but how would it be seen in DOM?
<my-container>
<some-child some-attr></some-child>
</my-container>
How can I get notifications in my-container when someone from outside adds another child to it?
- quest88 9y agoYes, it would be see by the DOM as Shadow DOM I believe. https://developers.google.com/web/fundamentals/architecture/building-components/shadowdom https://developers.google.com/web/fundamentals/architecture/... You can get notifications through the mutation observer API: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver https://developer.mozilla.org/en-US/docs/Web/API/MutationObs...
- zackbrown 9y agoI think MutationObserver[1] would be the with-the-grain answer here [1] https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver https://developer.mozilla.org/en-US/docs/Web/API/MutationObs...
- ergo14 9y agoYou can emit normal events (they bubble up normally), you can use a notification bus, redux, whatever you want. And your elements are visible in DOM normally like all other elements.