Re: [csswg-drafts] [selectors-4] reconsider specificity rule for :matches()

@jonathantneal, I agree with your understanding! This selector says "all following siblings of the `head` element _that are also_ children of the `html` element", i.e. this selector is equivalent to
```css
html > head ~ * {
  /* targeting elements that are siblings of `head` _and_ children of `html`
     implies that `head` itself must be child of `html`, too */
 }
```
However, your example made me realize that expanding the brackets of `:matches()` can be rather non-trivial when sibling combinators come into play. Before, I only considered nesting combinators, so examples like
```css
:matches(.a .b .c):matches(.d .e) { ... }
```
(based on examples above) would be expanded as
```css
.a .b .d .c.e,
.a .d .b .c.e,
.d .a .b .c.e,
.a.d .b .c.e,
.a .b.d .c.e {
   /* target elements with both 'c' and 'e' classes inside '.a .b' and '.d' in the same time */
}
```
which becomes rather verbose, but still much easier to figure out.

So some implementation feedback from the WebKit team would be really appreciated!

-- 
GitHub Notification of comment by SelenIT
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1027#issuecomment-391239419 using your GitHub account

Received on Wednesday, 23 May 2018 06:50:06 UTC