Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[selectors-4] Absolutizing relative selectors against a virtual scoping root is weird and broken #2199
Current spec prose:
There are three problems, corresponding to each point:
Also, in every other case, an author writing out an explicit
Possible ways forward:
I'm mostly in favor of the latter, since it seems simpler conceptually, as well as more author-friendly. There might be other solutions, but the current text is problematic imho.
No, the point of absolutizing something is to make it an absolute value, rather than being relative to something else. That's what the current spec text does. The fact that absolutizing such a selector produces something that can't be perfectly reproduced in a literal form is slightly inconvenient but irrelevant. (Had we decided the other way with
That's... fine? The point is that
No, it's working exactly correctly here. Again,
This is different from a non-virtual scoping root, which exists in a document with other elements outside of it, which could potentially be (incorrectly) matched by just treating the selector as absolute. Thus why you need to add
Possible but unnecessary - none of the "problems" you listed above are actually problems.
We could do this. The concept of an invisible featureless parent element didn't exist when I first wrote this text; the Shadow DOM stuff came later. Going this way would let us entirely remove this section and just rely on the standard scoping-root stuff, which is probably a good idea.
I think it's not only a good idea but a better idea.