W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2017

Re: [csswg-drafts] [selectors] Functional pseudo-class like :matches() with 0 specificity

From: Roman Komarov via GitHub <sysbot+gh@w3.org>
Date: Tue, 03 Oct 2017 13:07:05 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-333835590-1507036011-sysbot+gh@w3.org>
> Again: Would declarative-shadow DOMs help because they could reset styles and work around specificity issues on a component based level?

For my use cases — no. I've already mentioned [ITCSS](https://www.xfive.co/blog/itcss-scalable-maintainable-css-architecture/) — I'm using something similar to this, and saw other people using something similar to this. For our cases, having a better control over specificity means:

1. We would be able to create a better “default” styles (example: [normalize.css](https://github.com/necolas/normalize.css/blob/master/normalize.css) — it has selectors like `abbr[title]`, which are harder to override from your styles) easier and without a fear that adding new styles would mean we'd need to override stuff (we could have complicated rules for basic typography of elements like `h1 + p`, `li > p:first-child` etc. but with a specificity of one element, thus easily overridable).

2. We could make it sure the modifiers (in BEM notation) for our elements would always override the default styles, even if we'd need to have those default styles complex enough (like having a `.input` class which has different styles for `textarea.input` & `input.input`, but in a way later introduced `.input--bright` would override both of those more complex selectors).

3. With build tools like PostCSS or anything similar we could make it so that different levels of ITCSS wouldn't override each other (and those different levels can surely be used together on the same elements). Right now it is possible only by adding an excessive amount of extra classes/`[class]` to selectors, which is clearly a hack.

All of those cases (and there are more of them) don't have anything shadow DOM would help with.

GitHub Notification of comment by kizu
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1170#issuecomment-333835590 using your GitHub account
Received on Tuesday, 3 October 2017 13:07:01 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:19 UTC