3 ms·
I think I agree with basically everything on the list except one (I don’t think rgb/hsl should accept alpha arguments, rather rgba/hsla should have been availab
by eyelidlessness 6y ago
I think I agree with basically everything on the list except one (I don’t think rgb/hsl should accept alpha arguments, rather rgba/hsla should have been available from the start; but that’s probably an unrealistic expectation given the performance impact at the time), but haven’t thought through all the ramifications.
But one thing I’m disappointed isn’t on the list is a syntax sanity and unification proposal. CSS is a DSL so it gets some flexibility here, but there are far too many syntax variations for the same basic language primitives.
- Either all functions should require arguments separated by commas, or treat all commas between arguments as whitespace (helllloooo lisp)
- More to the point, a slash as an argument separator is bonkers. The rgb/hsl syntax breaks my brain every time I see them with an alpha value.
- Every shorthand should have a longhand equivalent (they’re finally fixing transform, but this is another syntax disaster).
- Lists should have delimiters at all. Or they should be an explicit function.
- Keywords should have some kind of sigil. The current state is untenable, as the keyword space is enormous and ever growing, making invalid bare strings (often used for browser compat) dangerously likely to become valid on unmaintained sites. The “don’t break the web” counter-instinct makes introducing new features almost guarantee more syntax fracturing.
- Either media queries should have been a part of selectors, or nesting should have been made available across the board (though I’ve seen rumors that this is being considered).
- Existing properties should get new values rather than introducing an ever growing, increasingly confusing, set of similar properties that do slightly different things in ways that are so inscrutable that even MDN can’t explain them in plain language.
- Feature forking should have its own syntax (eg or/cond type functions), not implemented as multiple definitions of the same property.
Partly syntax, partly behavior:
- Every pseudoclass should have a -within suffix equivalent, not just focus.
- Equal-specificity rules should be considered more specific by the order they apply to elements (ie the order classes are applied in markup), not the order they’re defined in the stylesheet. Atomic CSS is brilliant, but a minefield to generate programmatically (with any library in the space left to write tomes on ordering caveats), because the specificity spec is just plain wrong.
- Functions should be composable. And I’m thinking specifically about color manipulation here, so while I’m on the topic, HSLuv or some other perceptual color space should be supported.
- Styles in general should be composable in stylesheets. This can be as simple as a native extends keyword modeled on SASS, or as a function.
- chrismorgan 6y agotransform is not a shorthand: rather, it’s a set of transformation functions, akin to how background-image is a set of background images. The new properties for individual transforms (translate, rotate, scale) are new, supplementing the transform property and not supplanting it. See https://drafts.csswg.org/css-transforms-2/#individual-transforms https://drafts.csswg.org/css-transforms-2/#individual-transf... and https://drafts.csswg.org/css-transforms-2/#ctm https://drafts.csswg.org/css-transforms-2/#ctm for details.
- eyelidlessness 6y agoYou’re right, and this is a good clarification. And it’s a list, where order matters, as each transform applies to the result of the previous transform. This is a place where any kind of composition syntax would be a huge improvement, as it behaves much more akin to a pipe than a list.