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

Re: [selectors] What is the order of evaluation of :matches() and :not()?

From: Simon Sapin <simon.sapin@exyr.org>
Date: Thu, 28 Aug 2014 22:37:26 +0100
Message-ID: <53FFA116.7090904@exyr.org>
To: www-style@w3.org
On 28/08/14 22:30, Benjamin Poulain wrote:
> Hi,
>
> The order in which selectors are evaluated has various side effects
> on what and how rules are applied.
>
> One obvious example is the matching of :visited. Let say we have
> “:matches(:visited, .foobar)”. If a link has the class foobar, its
> style varies if the engine evaluate selectors from left to right or
> right to left.
>
> It looks like the order of evaluation should be defined to ensure all
> the browsers behave consistently.
>
> Alternatively, it can be defined that they all match as if each
> disjunction would produce a new rule, which is also fine as long as
> it is specified.

The comma inside :matches() (just like outside) indicates a 
boolean/logical "or". Since "or" is commutative (A or B == B or A, for 
every A and B), I don’t believe the evaluation order has any effect on 
the result.

(In this boolean view of Selectors, :matches() is just 
grouping/parentheses.)

Did I misunderstand your message?

-- 
Simon Sapin
Received on Thursday, 28 August 2014 21:37:50 UTC

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