-
Notifications
You must be signed in to change notification settings - Fork 243
Description
This is related to #3, which said “don’t merge rules if there are compatibility problems in their selectors”. I want to go beyond that: I want it to split rules if there are problems in their selectors.
If I write this:
:hover, :focus-visible {
color: red;
}
Then I expect to receive this if I specify a target that doesn’t support :focus-visible:
:hover {
color: red;
}
:focus-visible {
color: red;
}
In times long past, the unforgiving nature of selectors was occasionally used deliberately to target specific browsers, normally based on vendor-prefixed pseudoclasses, but I feel like that technique is very rare now, and @supports selector() would be the proper way of doing that now (though it’s certainly new enough to be of some concern). I think that defaulting to splitting for compatibility is going to solve far more problems than it causes.
I’ve chosen :focus-visible as my motivating example here, and it’s the case I’m most interested in, but this is a general matter, and #24’s replacing :focus-visible with a class is not what I want—I’m interested in pure-CSS techniques and optional enhancements where supported, but without having to think about whether you have to split it manually if not all of your target browsers support it.