W3C home > Mailing lists > Public > www-style@w3.org > April 2014

Re: Can we have more maths in calc()?

From: L. David Baron <dbaron@dbaron.org>
Date: Mon, 7 Apr 2014 18:22:03 -0700
To: Zack Weinberg <zackw@panix.com>
Cc: www-style list <www-style@w3.org>
Message-ID: <20140408012203.GA7111@crum.dbaron.org>
On Sunday 2014-04-06 21:36 -0400, Zack Weinberg wrote:
> If I can have _just two_ additional calc() features, min() plus being
> allowed to divide one <length> by another (the result being a
> dimensionless number) would mean not needing JavaScript in a scenario

For what it's worth, my previous post on why min() and max() are
hard(ish):
http://lists.w3.org/Archives/Public/www-style/2011Oct/0735.html

Adding division by lengths requires deciding how to handle division
by zero.  Currently calc() handles division by zero by rejecting
such values at parse time, but that's not possible with division by
lengths.  Like the min()/max() issue, it creates a bunch of new
error cases that we need to decide how to handle, though in this
case they're at least more clearly error cases that authors would
percieve as error cases.

Division by lengths (or times, etc.) also makes the rules for unit
analysis a bit harder, since it introduces the possibility of a
valid calc expression with multiple types of units (e.g., lengths,
times).  This isn't insurmountable, but requires a decent amount of
work.

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Tuesday, 8 April 2014 01:22:30 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:21 UTC