-
Notifications
You must be signed in to change notification settings - Fork 294
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
Extension only API to query across shadow trees #1321
Comments
To add some more context here, we recently had some discussions about this in the WebExtensions Community Group. While we could add an API in the extension namespace (e.g, browser.dom.querySelector) there was alignment across the extension teams from Chrome, Firefox and Safari that we would prefer to put this closer to the web platform. Based on previous discussions about other capabilities, I could imagine this being a new API or an That doesn't mean this has to be exposed to all sites - we could still allow the user agent to prevent anything other than an extension from calling it / setting the new flag. |
We most certainly need to do that. We don't want to expose this capability to regular scripts. |
Yes, this should only be exposed to isolated worlds of extensions, not the main world for normal page scripts. |
This comment was marked as spam.
This comment was marked as spam.
Perhaps we could add something like That still leaves the question of what exact API shape we want here, but would at least address the exposure question and present a path for other APIs of similar nature. (It would definitely increase the scope of what specifications have covered to date, but it's probably reasonable given the focus on interoperable extensions code.) |
So in terms of the actual API shape, I'm thinking that we want some kind of a way to query across shadow boundaries because iterating over each element and checking the existence of a shadow root is rather expensive. Maybe this could be a new option to |
It might be good to check in with folks writing accessibility auditing tools who have been asking for this type of API for years, too. |
It would be great if this API was not limited to extensions (although maybe they could have exclusive access to closed roots?). It's very useful for testing or any operations that need to act deeply on shadow roots like styling. Some related issues: |
Please file a separate issue to track a proposal for non-extension use cases. This issue is specifically about adding an API for extensions. |
What problem are you trying to solve?
Certain browser extensions need to query elements across shadow trees in order to implement features such as autofill.
What solutions exist today?
Chrome exposes
chrome.dom.openOrClosedShadowRoot
. Firefox exposeselement.openOrClosedShadowRoot
. Safari hascollectMatchingElementsInFlatTree
defined in window for Safari's autofill implementation.How would you solve it?
Ideally, we'd come up with an interoperable API for browser extensions that work across browsers.
Anything else?
No response
The text was updated successfully, but these errors were encountered: