W3C home > Mailing lists > Public > public-css-archive@w3.org > July 2018

Re: [csswg-drafts] [css-nesting] Concern about combinatorial explosion

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Thu, 05 Jul 2018 13:13:35 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-402717377-1530796414-sysbot+gh@w3.org>
> I don't think preprocessors are able to expand c d :matches(a b) to a selector pre-matches, are they?

They certainly can, but it explodes combinatorially:

c d a b
c da b
c a d b
ca d b
a c d b

In cases like this (like Sass's @extend), they use some heuristics to avoid having to fully expand the possiblities, while making it highly likely that what they do expand to is useful, but that's not strictly necessary.

> Consider for example, a b { & c d { } e f & { } }, what selector would you expand it to?

Just run the desugaring twice, man:  `e f :matches(:matches(a b) c d)`.

GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2881#issuecomment-402717377 using your GitHub account
Received on Thursday, 5 July 2018 13:13:38 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:33 UTC