W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2020

Re: [csswg-drafts] [css-syntax-3]: Voluntary semicolons (#5413)

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Mon, 17 Aug 2020 17:07:17 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-675000316-1597684036-sysbot+gh@w3.org>
> I see what you mean. But changes on sites would only occur, if the css was invalid with the current specs in the first place. But css is changing all the time.

"The CSS was invalid in the first place" is not a reason to break things. We don't have a moral right to bust older code just because it was wrong; it's written already, it's published, people are viewing pages with it, and if we change things around it, those pages might break.

We do occasionally make things that were previously invalid become valid; technically any addition to the language is doing that. Generally we believe there's a good chance we aren't affecting anyone (or at least, affecting a negligible number) by doing so; when, rarely, we believe there might be some decent impact, we try to measure it before we make the change.

This change is *almost certain* to have an impact on pages. It's not limited to a single property we're changing, or a single type of value. Leaving off a semicolon between declarations (thus ignoring both of them due to invalid syntax) can happen anywhere, to any property, and it's a common enough mistake that I know I've made it several times.

This doesn't *necessarily* mean we couldn't do it! We *could* carefully run searches over a corpus of public code, and probably instrument a browser's CSS parser to see how often it's encountered in the real world. However, to justify that effort, we'd have to have some pretty substantial benefit; that testing is expensive in terms of engineer time in the first place, and it's likely to show us some decent amount of accidental "usage" of the current parser's behavior, so we need something compelling enough that we can make a decent argument for making the change despite the breakage we observe (assuming it's a small enough amount, which we're not sure of).

This change does not do that, in my opinion. The sole benefit is that authors get to omit a single character from the end of their declarations. The downside is that if we ever have property syntax that contains an ident followed by a `:`, we'd need to engineer around this parsing behavior, and authors would have to be very careful about it as well. (And that *is* potentially valid syntax in a custom property with `"*"` grammar, which can take any value at all!) It still doesn't let authors actually just rely on indentation in their stylesheets, since they still need to wrap the declarations in `{}` (and *that* change is genuinely impossible in a backwards-compatible way, since Selectors grammar *already* allows "ident followed by colon" as a common thing).

GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5413#issuecomment-675000316 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 17 August 2020 17:07:19 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:13 UTC