-
Notifications
You must be signed in to change notification settings - Fork 371
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
A proposal to help with testing/SEO/accessibility of closed ShadowDOM #505
Comments
I'd prefer making |
I don't understand "allow crawling copy by script". Are you suggesting that returns a deep copy of the shadow root that is now accessible and no longer a shadow root but a @rniwa that makes more sense to me... |
Yeah, I think the proposal does not solve an issue at all... :( |
Is it possible to return a readonly tree from |
@treshugart I don't know what that means. What is a readonly tree? |
Immutable representation of the current state of the shadow root. |
|
Appearently it was not as obvious as I assumed
var docFrag = document.querySelector("x-user").cloneShadowDOM() docFrag:
the copy is of the content of the shadowRoot, not the shadowRoot itself. No open, closed mode applies. It is regular DocumentFragment This allows for content to be crawled for testing/SEO/accessibility purposes while leaving the original closed shadowRoot intact |
That is what I assumed you meant in #505 (comment). As far as I can tell that still leaks the kind of thing "closed" does not want to leak. |
I assumed, the reason for closed is "not to be tempered with", not necessary "not to be read" |
Reading it means that your program could become dependant on the internal state of the tree, which defeats one of the advantages closed provides. For automated testing, consideration for shadow trees really needs adding to the WebDriver spec. This has to be done regardless of any new methods that could be added to web components, so there's little point in adding them purely for that purpose. |
Hi as mentioned above, this is to help with those issues, not to solve them all, but how about adding
DocumentFragment Element.prototype.cloneShadowDOM()
I hope the signature is self-explanatory and the usecases are quite clear, since we've been discussing those issues for a quite some time.
This would allow closed ShadowDOM to remain closed, but allow crawling copy by script
Brona
The text was updated successfully, but these errors were encountered: