This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15598 - 0 needs to be allowed wherever we allow <angle>
Summary: 0 needs to be allowed wherever we allow <angle>
Status: CLOSED FIXED
Alias: None
Product: CSS
Classification: Unclassified
Component: Transforms (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Simon Fraser
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-17 19:35 UTC by Aryeh Gregor
Modified: 2012-02-13 16:48 UTC (History)
5 users (show)

See Also:


Attachments

Description Aryeh Gregor 2012-01-17 19:35:22 UTC
In all implementations tested (IE9, Firefox 12.0a1, Chrome 17 dev, Opera Next 12.00 alpha), using 0 for an <angle> works fine: rotate(0), skewX(0), skewY(0), rotate3d(1,1,1,0), rotateX(0), rotateY(0), rotateZ(0), and skew(0,0) all are treated as the identity matrix, not a parse error.  CSS Values and Units does not allow "0" as <angle>:

http://dev.w3.org/csswg/css3-values/#angles

I spoke with Tab Atkins, and he said the Transforms spec needs to be changed to explicitly allow 0 whereever it allows <angle> -- Values and Units is not going to be changed to allow 0 for <angle> the way it's allowed for <length>.  Perhaps after the text

"""
In this list the type <translation-value> is defined as a <length> or <percentage> value, and the <angle> type is defined by CSS Values and Units.
"""

we could add something like

"""
Wherever <angle> is used in this specification, a <number> that is equal to zero is also allowed, which is treated the same as an angle of zero degrees.
"""

(This affects all three of the transforms specs, but I'm filing against only CSS Transforms to avoid duplication.)
Comment 1 Simon Fraser 2012-01-25 18:21:58 UTC
Done once i commit.
Comment 2 Dirk Schulze 2012-01-31 17:49:51 UTC
(In reply to comment #0)
> I spoke with Tab Atkins, and he said the Transforms spec needs to be changed to
> explicitly allow 0 whereever it allows <angle> -- Values and Units is not going
> to be changed to allow 0 for <angle> the way it's allowed for <length>. 

Why isn't it allowed? 0deg, 0rad, 0grad, 0turn equals no rotation at all. Seems to be inconsistent for me. Where else do we use <angle> where 0 can't work?
Comment 3 Aryeh Gregor 2012-01-31 18:35:15 UTC
The problem is if you have a syntax that accepts both <length> and <angle> in the same place, and 0px does not have the same meaning as 0deg.  Personally I think such syntax is confusing anyway and should be avoided on those grounds, and if someone wants to do it we can have <length-with-unit>/<angle-with-unit> or something to get rid of the grammatical ambiguity.  But the Values and Units editors apparently disagree with me and will leave their spec as-is, so we have to make it explicit in our spec that we allow <number> as well as long as it evaluates to 0.
Comment 4 Dirk Schulze 2012-02-11 16:23:55 UTC
Simon fixed that already:

"Wherever <angle> is used in this specification, a <number> that is equal to zero is also allowed, which is treated the same as an angle of zero degrees."

 I close the bug for now.
Comment 5 Aryeh Gregor 2012-02-13 16:48:06 UTC
Looks good, thanks.