Skip to content
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

Should TreeWalker be expanded to support shadow roots in support of the selection API? #1189

Open
keithamus opened this issue Apr 22, 2023 · 3 comments
Labels
needs concrete proposal Moving the issue forward requires someone to figure out a detailed plan needs implementer interest Moving the issue forward requires implementers to express interest topic: nodes topic: shadow Relates to shadow trees (as defined in DOM)

Comments

@keithamus
Copy link

(from w3c/selection-api#164)

WCCG had their spring F2F in which this was discussed. Present members of WCCG identified an action item to raise this issue. You can read the full notes of the discussion (WCCG had their spring F2F) in which this was discussed, heading entitled "Selection API". I won't be quoting the notes for brevity.

TreeWalker was discussed as a mechanism to walk the DOM to gather textcontent of the currently selected nodes, but it was pointed out that TreeWalker does not iterate over shadow roots.

This issue is to discuss the expansion of TreeWalker to support shadow roots, perhaps using a shadowroots: option to provide contained shadow roots?

Refs w3c/selection-api#161

@keithamus keithamus added topic: shadow Relates to shadow trees (as defined in DOM) needs implementer interest Moving the issue forward requires implementers to express interest needs concrete proposal Moving the issue forward requires someone to figure out a detailed plan topic: nodes labels Apr 22, 2023
@annevk
Copy link
Member

annevk commented Apr 28, 2023

I personally consider NodeIterator and TreeWalker to be deprecated. We didn't go through the exercise of giving them useful constructors for instance. Based on that I'd be inclined not to update them, but if they have sudden surge in popularity we could revisit that I suppose.

@smaug----
Copy link
Collaborator

Do we have any use counters for the APIs? (Firefox doesn't have)

@zcorpan
Copy link
Member

zcorpan commented Jun 19, 2023

We have httparchive! Total number of pages in the dataset is 12,808,711.

  • 979,195 = 7,64% of pages use createNodeIterator()
  • 2,708,575 = 21.15% of pages use createTreeWalker()

https://docs.google.com/spreadsheets/d/1AJRajLjk7SvKTjuZMUOsYHobgFVThA5BN-Na2qNoTKA/edit?usp=sharing

From looking at the first bunch it looks like adsense appears pretty frequently.

Reducing to first-party resources, we get:

  • 208,801 = 1.63% of pages with first-party createTreeWalker()
  • 74,335 = 0.58% of pages with first-party createNodeIterator()

https://docs.google.com/spreadsheets/d/1IKPHOVHugHS0pwHvNj6TbpSiIBZM18KpUGI0nLvKmeY/edit?usp=sharing

https://almanac.httparchive.org/en/2022/javascript#fig-45 says last year 0.39% of pages use shadow dom. Assuming an even distribution the pages using both shadow DOM and first-party createTreeWalker() would be 0.009% of pages; shadow DOM and first-party createNodeIterator() 0.002% of pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs concrete proposal Moving the issue forward requires someone to figure out a detailed plan needs implementer interest Moving the issue forward requires implementers to express interest topic: nodes topic: shadow Relates to shadow trees (as defined in DOM)
Development

No branches or pull requests

4 participants