W3C home > Mailing lists > Public > public-css-archive@w3.org > March 2017

[csswg-drafts] [selectors4] :for selector

From: Ryan Van Etten via GitHub <sysbot+gh@w3.org>
Date: Wed, 01 Mar 2017 00:00:05 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-210939909-1488326403-sysbot+gh@w3.org>
ryanve has just created a new issue for 
https://github.com/w3c/csswg-drafts:

== [selectors4] :for selector ==
This is a concept for a new `:for` selector applicable to 
[`<label>`](https://www.w3.org/TR/html5/forms.html#the-label-element).
 Its primary use case would be to allow developers to target labels 
based on the state of their associated form control. It should work 
regardless of whether the label is associated via `[for]` or nesting. 
My initial idea was pseudo selectors like `:for-disabled` or 
`:for-checked`. While I like the simplicity of those perhaps a `:for` 
selector function similar to `:matches` would be more capable.

## Proposed Syntax

`:for(selector)` would target labels whose associated form control 
matches `selector`

### Examples

- `:for(:disabled)` would target labels whose associated form control 
is `:disabled` 
- `:for(:checked)` would target labels whose associated form control 
is `:checked` 
- `:for(:valid)` would target labels whose associated form control is 
`:valid` 
- `:for(:required)` would target labels whose associated form control 
is `:required` 
- `:for(.a, .b)` would target labels whose associated form control is 
`.a` or `.b`
- `:for(.a.b)` would target labels whose associated form control is 
`.a` and `.b`

Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/1067 using your GitHub 
account
Received on Wednesday, 1 March 2017 00:00:11 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:30:29 UTC