[csswg-drafts] [selectors4] :for selector

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