Skip to content

Tag: shadow-dom

Adding an event within a WebComponent

I want to create a Web Component. I use a ShadowDom and after generating a list I want to add a click Event to each element of the list. But I wonder how to access the list. Neither the document nor the template shows me the items after a querySelect. My question: How can I access the generated list within

child elements usage in shadow dom

Is there any constraint that’s preventing <thead>, <tbody>, <tr> and so on to be slotted in shadow DOM? Given the following example: renders into the following structure: The workaround would be to use templates and insert template content with JS in slotchange event handler, but I wou…

Detect attachShadow event

I’d like to detect an event of attaching shadow to the host element. Use-case: using MutationObserver to watch any DOM changes and post-process the changed content as part of binding (tying) framework’s logic. Why do I need to detect this event? In order to be able to watch for a changes within th…

MutationObserver and Shadow DOM

I’m using Polymer’s ShadowDOM and MutationObserver polyfills and need to: Detect when a HTMLCanvasElement is inserted so that I can perform layout (its width and height are undetermined through offsetWidth / offsetHeight when detached from the DOM tree) Detect when the element is removed so I can …