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

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