-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attachShadow options #26
Comments
Yeah that looks like a convenient way to expose it. Might call it A workaround for now is you could override Line 214 in 9b374f1
then override the Lines 223 to 235 in 9b374f1
to return the root with Besides the mode option, more options are coming out, so we still want to make it easy to configure, so this is a good idea. But in general in the Custom Elements world, avoiding mode:closed is considered best practice for a number of reasons. Typically allowing users to access the ShadowRoot is good for customization, so they aren't blocked, and besides mode:closed is only really like a signal to say "hey, don't touch this unless you know what you're doing, it is very likely to change" or similar, but the thing is, it is very easy to get access to closed roots by overriding Example: <script type="module">
const root = document.body.attachShadow({mode: 'closed'})
root.innerHTML = `<div></div>`
const div = root.children[0] // 3rd party element f.e.
console.log(document.body.shadowRoot) // null
console.log(div.getRootNode().host) // body
</script> |
Hey, is there any way to set attachShadow options? I'm looking at getting the content of the shadowRoot, so it gets included in the html when I save the full page to disk. Maybe
static attachShadowOptions = {mode:'closed'... }
?The text was updated successfully, but these errors were encountered: