W3C home > Mailing lists > Public > www-style@w3.org > July 2012

[css3-values] valid rationale for not allowing spaces around '+' and '-' to be dropped (was: [CSSWG] Minutes and Resolutions 2012-07-04)

From: Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>
Date: Thu, 05 Jul 2012 09:05:01 +0800
Message-ID: <4FF4E83D.3090700@csail.mit.edu>
To: WWW Style <www-style@w3.org>
(12/07/05 3:34), fantasai wrote:

> Values and units issues
> -----------------------
>   <fantasai> http://dev.w3.org/csswg/css3-values/issues-lc-2012#issue-35
>   <fantasai> whether calc should make whitespace optional around + -
>   fantasai: because - forms part of an ident
>   fantasai: rejected because it means you can't put keywords in calc in
> future
>   <fantasai>
> http://lists.w3.org/Archives/Public/www-style/2012May/0463.html

I don't think this is a valid rationale, or at least it's incomplete.
The proposal as discussed in the link above is to change DIMENSION and
leave IDENT alone. It's true that in this proposal the space around '-'
can not be dropped when one of the two sides is an IDENT, but this is
learn-able (would people seriously think "auto-min-content" would work?)
and otherwise the proposal works.

>   <fantasai> proposal: no change, white space is required
>   fantasai: saying no change to calc, whitespace is required around + and -
>   hober: why not require it around / and * for consistency
>   fantasai: they don't need it
>   smfr: hard for authors to remember where to put whitespace
>   fantasai: just put white space everywhere
>   fantasai: */ bind tigheter than + and - , so the current requirements
>             make sense
>   dbaron: gecko implements what the spec says
>   RESOLVED: accept the rejection of this issue
>   plinss: do we want to require whitespace around / and *?
>   dbaron/fantasai/florian: do not want
>   RESOLVED: leave the rest alone

Given that there's a consistency issue here and in my mail[1] I cited
two pages where the community expresses negative opinion to this, I
think it's particularly important to make sure we have sound and valid
rationale even we reject this.

Some rationale why we can't allow space around '+'/'-' to be dropped:

1. If we are to introduce keywords in calc() in the future, the spaces
around '-' can't be dropped when one of the two sides is a IDENT so it
is inconsistent.
2. Browsers already implement this and changing it doesn't worth it.
3. We don't want to change the core grammar (for IDENT).


I consider 1. to be quite minor a point. We don't know when we'll
introduce keywords in calc() and even we do so, not being able to drop
the spaces in certain situations is only a natural consequence of how
CSS tokenization works. It's just not easy to remember that a unit can
have a '-' in it!

2. is also quite minor. This really isn't hard to implement.

I consider 3. minor too, given that we do are changing it.


I think we are just currently at an unfortunate middle point. We don't
require spaces around / and * but we require spaces around + and - even
when these are not required for tokenization. (Note that there would be
a lot more calc(x% - yem) than, say, calc(100vw - 2em), I think.)

[1] http://lists.w3.org/Archives/Public/www-style/2012May/0404


Cheers,
Kenny
Received on Thursday, 5 July 2012 01:05:27 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:56 GMT