Probably simple question, that I haven't really found an answer for:
Does ShadowDOM or WebComponents (as the bigger Standard) actually encapsulate JavaScript aswell? Like having seperate namespaces for each component?
From what I encountered with Polymer that wasn't the case yet, which is obvious, given that polymer is doing it's polyfilling through JS.
Thanks!
The Shadow DOM and Custom Element specs say nothing about script encapsulation. The only thing that SD gives you is <style>
encapsulation and event retargeting (events look like they come from the host element and not internal elements. For custom elements, you can do tricks to namespace your JS (e.g. anonymous self calling functions, wrapping the constructor in a namespace, etc.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With