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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 29 Aug 2014 08:30:53 +1000
Message-ID: <CAAWBYDAxG8ntF0CnZ=4HPOZYu8tTfDDya9sQQVw3Soz13BP8bw@mail.gmail.com>
To: Benjamin Poulain <bpoulain@apple.com>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, www-style list <www-style@w3.org>
On Fri, Aug 29, 2014 at 8:08 AM, Benjamin Poulain <bpoulain@apple.com> wrote:
> On Aug 28, 2014, at 2:35 PM, Boris Zbarsky <bzbarsky@MIT.EDU> wrote:
>> On 8/28/14, 5:30 PM, Benjamin Poulain wrote:
>>> 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.

That still has nothing to do with ordering, unless you assume that
:matches() short-circuits and stops when it first finds a match. (It
probably does, in implementations, but it's not specified as such.)

If this example really does give any problems for a browser, it's a
bug in their handling of the "UAs may [...] implement other measures
to preserve the user’s privacy while rendering visited and unvisited
links differently." escape hatch.  They should ensure that the
:visited styling restrictions don't apply to :visited in :matches()
when a non-:visited branch also matches.

~TJ
Received on Thursday, 28 August 2014 22:31:42 UTC

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