-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[selectors4] :for selector #1067
Comments
I think #397 is a better solution for this problem. |
Copying over the comment by @Boldewyn from the duplicate issue #5240: In 2015 I suggested on the mailing list to add a new pseudo-class @frivoal said, that such a feature is actually planned. However, as far as I can tell from the current WD, there seems to be no motion in this particular direction. Therefore I wanted to bring it back to attention. After 5 years I still would find it tremendously helpful to style non-trivial forms. Thanks to @CarlosMadeira to poke me to write up this issue! Back in the days I also prepared a gist to showcase the features and define the problem set, that Copy ’n pasted description, that I posted on the mailing list:
If there is anything I can do to help further this proposal (opening tickets in browser vendor bugtrackers, drafting copy for the spec, ...), I’d be glad to help. |
Thank you, @AmeliaBR! To respond to @fantasai’s comment from 2017: Yes, #397 would address a substantial subset of the needed features. But AFAICT there are other use cases, that are not covered, because they are not bound to the state of the input. E.g., addressing all labels for some kind of currency input, |
To extend on @Boldewyn's post, a function has the advantage of allowing to filter the form controls by more than their states. The syntax for this could be: :for([<type-selector>? <subclass-selector>*]!) Note: This syntax does not cover the Sebastian |
This is a proposal for a new
:for
selector applicable to<label>
. 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 a label is associated via[for]
or nesting. My initial idea was pseudo selectors like:for-checked
. While I like that simplicity, a:for
selector function similar to:matches
seems more capable.Proposed Syntax
:for(selector)
would target labels whose associated form control matchesselector
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
The text was updated successfully, but these errors were encountered: