- From: fantasai via GitHub <sysbot+gh@w3.org>
- Date: Thu, 18 Jan 2018 00:54:45 +0000
- To: public-css-archive@w3.org
fantasai has just created a new issue for https://github.com/w3c/csswg-drafts: == [selectors-4] Absolutizing relative selectors against a virtual scoping root is weird and broken == Current spec prose: > If there are no :scope elements and the selector is scoped to a virtual scoping root: > 1. If the selector starts with a child combinator, remove the child combinator. The selector is now absolute, with the additional constraint that the first compound selector in the selector only matches elements without a parent. > 2. Otherwise, if the selector starts with any combinator other than the white space form of the descendant combinator, change the selector to :not(*). This is the shortest selector that is valid, but guaranteed to match nothing. > 3. Otherwise, the selector is already absolute. There are three problems, corresponding to each point: 1. The resulting “absolute” selector is carrying out-of-band information. The point of absolutizing something is to incorporate contextual information into the thing itself. At least before we remove the combinator in `> foo`, it's clear that it's not representing the same thing as `foo`. 2. `:not(*)` is guaranteed to match nothing only if it's not in a negated context. If it's negated, then we match everything. So this is not a good way to represent a selector that matches nothing. 3. If `foo` as a relative selector with a non-virtual scoping root is absolutized to `:scope foo`. Since we don't consider it acceptable for absolutizing `foo` as `foo` in that case, then how is leaving `foo` as `foo` here considered acceptable? Either both cases need some kind of transformation, or neither of them does. This whole section is weird, inconsistent, and broken. Possible ways forward: - Give up on the concept of “absolutizing” a selector and define matching against relative selectors as its own special thing. - Define `:scope` as matching against virtual scoping roots and let relative selectors absolutize the same regardless of the root type. (We already have a concept of “featureless” elements, we just define it as “featureless” and that a selector with it as the subject returns nothing.) Relative selectors then return to being syntactic sugar for a prefixed `:scope`. I'm mostly in favor of the latter, since it seems simpler conceptually. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2199 using your GitHub account
Received on Thursday, 18 January 2018 00:55:17 UTC