Skip to content

will it work for shadow-root (closed) element? #51

Answered by sukgu
sseenivasan89 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @sseenivasan89 , closed shadow DOMs are not meant to be accessed by the outside world. This is a design feature. So it's not automatable.

From official docs https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM

open means that you can access the shadow DOM using JavaScript written in the main page context, for example using the [Element.shadowRoot](https://developer.mozilla.org/en-US/docs/Web/API/Element/shadowRoot) property:


If you attach a shadow root to a custom element with mode: closed set, you won't be able to access the shadow DOM from the outside myCustomElem.shadowRoot returns null. This is the case with built-in elements that contain shadow DOMs, such…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sseenivasan89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants