-
Notifications
You must be signed in to change notification settings - Fork 240
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
Add pierce option to DOM.querySelector[All] #19
Comments
@paulirish was asking me about this and it turned out that this was needed for image / raster resolution mismatch. I wonder if a more straightforward event upon image resize would suffice. Could you explain your use case in greater detail? |
Basically, we have a number of audits that collect nodes from the page and need to be aware of shadow trees. To date, we've done that using So for example, I'm not sure how we use the protocol to do the equivalent of this:
Other examples (some we still need to make shadow dom aware) in the codebase: link-rel-opener audit - all-event-listeners.js - links blocking first paint |
It is not practical to grow DOM domain to satisfy those, it is easier to inject snippets of JS that would do the job. It would involve piercing shadow, but that's straightforward. Since this patch you can create isolated worlds (content scripts), so your injected snippets won't be detected. |
Just to note: this isolated worlds patch landed in 60.0.3097.0 |
FYI |
I put this together for use with a Selenium based Automation framework, performance might be all that but should work for my E2E testing use case: https://www.npmjs.com/package/query-selector-shadow-dom |
This repository is related to Chrome DevTools Protocol, but does not track issues regarding its definition or implementation. If you want to file an issue for the Chrome DevTools Protocol, please open an issue on https://crbug.com under |
The
/deep/
combinator is being deprecated in the platform. Unfortunately, we use this in Lighthouse in a couple of places to find nodes within shadow roots. This gets injected into the page:In Chrome 60, we'll have to move to DOM traversal [1] or use the protocol to get the full tree:
However, this method is less convenient than qS() and only works against the root node. In some parts of the code, we still want to select nodes from the DOM using a complex CSS selector.
Ideally,
DOM.querySelector/DOM.querySelectorAll
could be updated to accept a{depth: -1, pierce: true}
option....nodes within shadow trees would be returned.Thoughts? Is there already a way to make this work?
[1]:
The text was updated successfully, but these errors were encountered: