[css3-flexbox] "<flex> can also transition to and from a <length>"

Hi www-style,

TL;DR VERSION:
The part of the spec that says "<flex> can also transition to and from a
<length> [...etc...]" isn't really useful right now -- I think it _wants_
to (but doesn't currently) explain how transitions work between flex
values that involve 'auto' as the preferred-size.

NON-TL;DR VERSION:

This part of the spec (which I'll call "Chunk A") is good:

[[
A ‘<flex>’ value is transitionable, by transitioning the preferred size,
positive flexibility, and negative flexibility independently.
]]

... but the next sentence (which I'll call "Chunk B") needs tweaking, I think:

[[
 ‘<flex>’ can also transition to and from a <length>, by treating the
length as if it were a flexible length with a positive and negative
flexibility of zero and a preferred size of the length.
]]

Taken literally, Chunk B _sounds_ like it's describing e.g. this transition:
  "flex: 1 0 5px"  --->  "flex: 10px"
        <flex>     --->         <length>

However, in that context, the "flex: 10px" is _already_ a <flex> value
(according to the definition in Section 7), and it already computes to "0
0 10px".  So there's no need to explain that here in a special case.  In
other words, taken literally, Chunk B is superfluous.

I don't think Chunk B wants to be taken literally, though -- I suspect it
was _intended_ to describe transitions between e.g. flexible values and
'none'.  But note that none computes to '0 0 auto', and there's no reason
to give that specific value special transition treatment -- if we're
handling that, we might as well handle transitions between any flex value
that uses 'auto'.

(Presumably, we'd handle 'auto' by substituting in the computed value of
'height' or 'width' for the "auto" value, as appropriate, and then
continuing with the transition as described in Chunk A.  And of course if
the given element isn't a child of a flexbox, then the meaning of an
'auto' preferred size is undefined, so we can't transition.)

~Daniel

Received on Friday, 6 April 2012 07:52:35 UTC