Skip to content

Selector lists should be split if some parts are unsupported #311

@chris-morgan

Description

@chris-morgan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions