Fix :scope selector matching in the case of DocumentFragment/ShadowRoot #12839
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When used in querySelector and querySelectorAll, :scope should match
the element or the DocumentFragment/ShadowRoot the querySelector is
called on. However, WPT adeed in crrev.com/c/1158445 shows that :scope
matches nothing when querySelector is called on shadow root, while it
works fine when querySelector is called on true element.
This CL fixes :scope selector matching process so that :scope itself
matches DocumentFragment/ShadowRoot when querySelector is called on
DocumentFragment/ShadowRoot. Tests for DocumentFragment are also added
in this CL.
Link to the spec:
https://drafts.csswg.org/selectors-4/#the-scope-pseudo
Link to related issue:
w3c/csswg-drafts#3016
Link to related CL:
crrev.com/c/1158445
Bug: 859692
Change-Id: If20fc4b122d93a553dc478be0ee958958340a34f
Reviewed-on: https://chromium-review.googlesource.com/1203472
Reviewed-by: Rune Lillesveen futhark@chromium.org
Reviewed-by: Rakina Zata Amni rakina@chromium.org
Commit-Queue: Momoko Sumida momon@google.com
Cr-Commit-Position: refs/heads/master@{#590595}