W3C home > Mailing lists > Public > www-style@w3.org > November 2014

Re: [selectors] Assistance requested in figuring out the data model of pseudo-elements

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 26 Nov 2014 09:36:39 -0800
Message-ID: <CAAWBYDDy3yqRgVszjOP+sDGWQZaH1Ss6N=MboF7tDWrxyb289g@mail.gmail.com>
To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Cc: www-style list <www-style@w3.org>
On Wed, Nov 26, 2014 at 1:23 AM, Daniel Glazman
<daniel.glazman@disruptive-innovations.com> wrote:
> On 25/11/2014 22:37, Benjamin Poulain wrote:
>> In practice in WebKit, we have been using :matches() as a magic operator
>> that generates a disjunctive normal form of the selector.
> That sentence alone scares me to death.
> I still need to understand why we should expose this to the general
> public. How is it useful to web authors? Can you please give us a
> simple real-life use case?

Putting selectors in DNF isn't scary; it just means that `A
:matches(B, C) D` becomes `A B D, A C D` (selectors in a selector list
are basically related by disjunction).

In the call you asked for use-cases; I gave one there, but I can
repeat it here for posterity: the use-case is identical to normal
:matches().  Look in our own specs' stylesheet, for example, we have
the following:

pre .property::before, pre .property::after {
  content: "";

And a few more that work similarly.  With :matches() or something
similar, we could write:

pre .property:matches(::before, ::after) {
  content: "";

Saving ourselves a few keystrokes, and more importantly, reducing the
risk of the rest of the selector drifting apart when people
accidentally edit only one branch.

Received on Wednesday, 26 November 2014 17:37:26 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:48 UTC