logoalt Hacker News

groby_blast Thursday at 5:21 AM3 repliesview on HN

It is extremely funny to me that the list thinks the mistake about !important was using the exclamation mark sigil, and not the concept of a single priority level.

In the words of one of my CS profs, from a few decades ago: "There are only 3 numbers - zero, one, and infinity. And 'one' is often a mistake"


Replies

semolinolast Thursday at 12:53 PM

This is what Cascade Layers was designed to solve:

https://developer.mozilla.org/en-US/docs/Learn_web_developme...

A lingering bit of weirdness is that all !important declarations, no matter the layer they appear on, are interpreted as being part of their own implicit layer.

dnplslast Thursday at 3:10 PM

There is no need for more priority levels, because precedence is already defined by inline > #ID > .class / [attribute=""] / :pseudo-classes / elements / ::pseudo-element / universal selector (*). And the order they're written, if both have the same priority. The !important just exists to override that order.

colechristensenlast Thursday at 6:54 AM

As opposed to the 15 levels of priority available in Chef.

5 different types (default, force_default, normal, override, force_override)

which can be in 4 different places (attribute, node, environment, role) but not all of the types can be in all of the places

PLUS the "automatic" type, which is from somewhere else entirely

Oh and there's inheritance and merging which does not behave intuitively at all because it's not exactly inheritance.

In other words I have early career trauma from someone's extremely unwise priority implementation and am deeply suspicious of ANY priority override system which isn't just code I've written in a normal programming language.