News for hackers. Stuff that matters.
Re:Show HN: ECSS – Simple rules for efficient CSS by isleyaardvark on Thursday March 14, 2024 @11:52AM (#39705554)
I think these rules (and I think they are excellent) are poorly named as "efficient" css. That makes me think of performance.

In that case, yes it's less performant. But the specificity problem is so significant that I've followed the rule of never using ids for styling at all. The problems I've run into with CSS have entirely been regarding maintainability and preventing visual bugs, I've never had any CSS performance problem worth addressing. (I almost skipped this submission because I thought that was what is about, I'm glad I didn't.)

Re:Show HN: ECSS – Simple rules for efficient CSS by psygn89 on Thursday March 14, 2024 @06:41PM (#39709808)
True, this change is about maintainability.

I'm sure the browser css engine treats that id attribute selector (without any regex-like) as an #id. Now if it were [id(*|^|$)=''] then it could have performance consequences, but they won't show up until you have thousands upon thousands of elements at which point maybe you should've looked into virtualization yesterday and not jump to wildcard selectors (speaking from experience).

Re:Show HN: ECSS – Simple rules for efficient CSS by emmacharp on Friday March 15, 2024 @06:32AM (#39714028)
I see, yes. I meant "efficient" in it's pure economic definition:

Producing effectively with a minimum of waste, expense, or unnecessary effort.

Is there a better term you're thinking of?

And in my experience, the performance cost of using attribute instead of id selectors is so small as being imperceptible. So, as you say, the gain of suing them far outweighs the possible cost.