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

Re: [selectors4] feedback

From: Mark Brown <mark@mercurylang.org>
Date: Thu, 1 Sep 2016 05:39:09 +1000
Message-ID: <CAM4AczATM-tRQ9wufq8CdTqmKRxNaRmzH_FDTRaa1C=PLuu3=g@mail.gmail.com>
To: W3C www-style mailing list <www-style@w3.org>
Hi Gareth,

On Mon, Aug 29, 2016 at 11:47 PM, G. A. Light U1365222
<U1365222@unimail.hud.ac.uk> wrote:
> I believe that it would be beneficial for a selector similar to :blank &
> :empty to be added...
>
> This selector would include elements with content that are not visible (for
> example through display:none)
>
> It is worth noting that this could be used to style the parent of an element
> - without any concerns over abuse;

That sounds like a challenge ;)

> <ul>
> <li><a href="bad link">invalid</a></li>
> <li><a href="./valid.html">valid</a></li>
> </ul>
>
> With the following styles:
>
> a[href="bad link"] { display:none; }
> li:nodisplay { display:none; }
>
> Where :nodisplay is a temporary name simply to illustrate it.
>
> In this case the link would be set to display:none and subsequently as there
> are no more visible elements in its parent element, the parent would also be
> hidden.

What if there is another rule:

li:nodisplay > a[href="bad link"] { display:inline; }

?

This is more specific than the first rule and, since the first two
rules fired, this does too. But then display is inline, so the second
and third rules shouldn't fire after all! We seem to have a paradox.

In general this kind of thing can happen if there are selectors that
depend on property values. To avoid the problem, CSS doesn't allow
selectors like that.

Mark
Received on Wednesday, 31 August 2016 19:39:39 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 31 August 2016 19:39:39 UTC