News for hackers. Stuff that matters.
Re:Everything that uses configuration files should report wh... by tobr on Sunday June 25, 2023 @08:29AM (#36467513)
> I can’t imagine I’d want this level of complexity in config files.

Lots of people don’t want it in their CSS either. It’s generally considered good practice to make everything the same specificity and avoid !important.

Re:Everything that uses configuration files should report wh... by lavela on Sunday June 25, 2023 @09:35AM (#36468047)
> avoid !important

Sure, haven't seen that in a while in well structured code bases.

> make everything the same specificity

How would you achieve same specificity on everything? Only use either ids or classes? No type selectors / pseudo-classes / pseudo-elements / multiple selectors? I can't imagine how that would be feasible and am not aware of anyone recommending this.

Re:Everything that uses configuration files should report wh... by Supermancho on Sunday June 25, 2023 @10:45AM (#36468692)
There are a large number of companies that require ids as the basis for every selector, by policy. This may not be interesting to you, but I think this is what they meant. The fact they may or may not be familiar to you is incidental.
Re:Everything that uses configuration files should report wh... by lavela on Sunday June 25, 2023 @12:06PM (#36469689)
I'm familiar with policies that generally strive for specificity of (0, 1, 0) like BEM or (1, 0, 0), but I'd be very interested in any policy that rules out pseudo-classes like `:hover`, as prohibiting them would leave you to handle any interactivity you'd get for free from CSS via JavaScript.
Re:Everything that uses configuration files should report wh... by blowski on Sunday June 25, 2023 @01:13PM (#36470464)
This is effectively how Tailwind works. You end up with classes like `hover:text-black`.
Re:Everything that uses configuration files should report wh... by afiori on Sunday June 25, 2023 @02:59PM (#36471471)
With :is and :where it is trivial to trick selectors

:is(selector_1, :where(selector_2))

Has always the specificity of selector_2, and if you choose an impossible selector for selector_1 (the easiest approach is to give multiple ids or use non existent classes/elements) it only select by selector_2

Re:Everything that uses configuration files should report wh... by oneeyedpigeon on Monday June 26, 2023 @03:55PM (#36484946)
That looks far more complex than just using specificity properly as intended.
Re:Everything that uses configuration files should report wh... by cerved on Monday June 26, 2023 @01:32AM (#36476052)
Perhaps you mean the same kind of specificity.

Specificity is at the heart of CSS, you're not supposed to design rules with equal specificity