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

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

From: Benjamin Poulain <bpoulain@apple.com>
Date: Thu, 28 Aug 2014 15:08:02 -0700
Cc: www-style@w3.org
Message-id: <1F00E079-D014-4196-93BE-528533716A1E@apple.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
On Aug 28, 2014, at 2:35 PM, Boris Zbarsky <bzbarsky@MIT.EDU> wrote:
> On 8/28/14, 5:30 PM, Benjamin Poulain wrote:
>> The order in which selectors are evaluated has various side effects on what and how rules are applied.
> 
> It shouldn't.  Why would it?

It would be a bit long to explain the details here, the best is probably for you to read a bit the styling code of an opensource web engine like Gecko, Webkit, blink, etc to learn more.

I could find a little introductory article here, that may help: http://dbaron.org/mozilla/visited-privacy

>> 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 shouldn't.  Can you give an actual example where it does?


Let say we have:

<style>
:matches(:visited, a) {
    display:block;
    width: 100px;
    height: 100px;
    background-color: red
}
</style>
<a href=“http://w3.org”>link</a>

If only the first one is match, we are in the “visited” case, and none of the properties apply. If the second one is matched, all the properties apply.

Benjamin
Received on Thursday, 28 August 2014 22:09:36 UTC

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