W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2020

Re: [csswg-drafts] [selectors] :visible pseudo-class for targeting only visible elements (#5827)

From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
Date: Tue, 29 Dec 2020 16:54:23 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-752157431-1609260862-sysbot+gh@w3.org>
How do you avoid cycles?

```css
:visible { display: none }
```

And BTW, `:first-child:visible` would match the first child *if* it's visible, instead of the first visible child. That would be `:nth-child(1 of :visible)`.

> this is extremely useful for situations where a script or style tag might appear first in the DOM but is not visible to the user.

I think it would be easier to cover this usecase with a `:metadata` pseudo-class, matching [metadata content](https://html.spec.whatwg.org/#metadata-content-2): `base`, `link`, `meta`, `noscript`, `script`, `style`, `template`, `title`. But I'm not convinced this is worth it.

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5827#issuecomment-752157431 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 29 December 2020 16:54:25 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:24 UTC