Re: [csswg-drafts] [css-specificity] Add specificity property modifier (replace !important) (#3890)

The proposal looks good to me. Especially if the argument is a constant number and not a var. However, the issue with this proposal is that is no polyfillable and thus it'd take quite a long time before it can be used freely across the Web. Currently the main tool available to us is "keep CSS selectors as simple as possible and order CSS rules correctly". In a naive case, if all CSS selectors were a single class (`.myclass`) selectors, then the best specificity control is the order of CSS rules. So I'm wondering if it'd be possible to construct this proposal to ensure that it can be fully pollyfillable using a simple and safe reordering. If it were possible, then PostCSS/WebPack/etc plugins could close the gap. 

For instance, the following constraint could help: the `specificity` argument cannot be smaller than the CSS selector where it's used. Or (better?), the argument would mean "added specificity" and will be added to the selector's specificity. To stress: I'd certainly like the ability to lower specificity in this proposal, but it cannot be polyfilled.


-- 
GitHub Notification of comment by dvoytenko
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3890#issuecomment-611251276 using your GitHub account

Received on Wednesday, 8 April 2020 23:50:12 UTC