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

Re: [css3-values] proposal for handling division and units in calc() [ACTION-205]

From: L. David Baron <dbaron@dbaron.org>
Date: Mon, 26 Jul 2010 09:54:54 -0700
To: Brad Kemper <brad.kemper@gmail.com>
Cc: "www-style@w3.org" <www-style@w3.org>
Message-ID: <20100726165454.GA12756@pickering.dbaron.org>
On Monday 2010-07-26 09:24 -0700, Brad Kemper wrote:
> It just seems odd that it would be OK to write
> 'calc(0.333333333in)' but not 'calc(1/3in)'. I know there are
> other ways to work around that as an author, but still...

Yes, but you can write calc(1in/3).

I'd also note that calc(1/3in) would not work in either proposal,
since units of 1/length aren't values for any property.

(It might be easier to think about with times, since dealing with
units of 1/time is more common than dealing with units of 1/length.
1/5s == 0.2Hz; seconds and Hertz are different units, but
reciprocals of each other.)

> What if you just parsed as normal, and then anything that would
> end up meaning "divide by zero" was nudged into meaning "divide by
> 0.000001", or something similar that would not be rounded to zero
> even if the final used value is rounded to zero?  In that case,
> you wouldn't need to discard the declaration at parse time.
> By the way, I'd be fine with not allowing units in the divisor
> that were not  allowed as the final value (so no 'Hz' or  's' for
> lengths).

But what's the use case for this?

We *could* do it, but it's a lot more work, and I don't see why it's
worth doing.  I don't see it as anything anywhere near as important
as the reason authors are asking for calc().


L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Monday, 26 July 2010 16:55:26 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:13:48 UTC