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

On Fri, Apr 6, 2012 at 4:53 PM, Daniel Holbert <dholbert@mozilla.com> wrote:
> Hmm... So on further reflection, I realized that it's problematic for
> transitions to depend on whether or not we're a flexbox item.
>
> The definition of "flexbox item" depends partly on what the underlying
> element is -- e.g. <img> & <embed> vs <span> & <i>.
>
> Transitions, however, happen in the style system, so they don't have
> access to what the underlying element is. (at least, they don't in Gecko)
>
> For example: Suppose we've got "flex:1 0 auto" on both an <img> and a
> <span> inside a flexbox, and then we tweak that to "flex: 10px". The
> spec currently says that the <img> should transition this change,
> whereas the <span> shouldn't -- however, we have no way to figure that
> out from inside the style system.  (Of course, even if we transitioned
> the span, it wouldn't have a visible effect since 'flex' is going to be
> ignored -- still, the intermediate values of 'flex' would be exposed via
> the computed style of the 'flex' property.)
>
> I think the simplest way to resolve this is just to change "flexbox
> item" to "child of a flexbox" here:
>> The ‘flex’ property is transitionable if the element is a flexbox item
>
> Thoughts? Does this make sense?

I see what you're saying, but I'm not sure it's as problematic as you assert.

By the time transitions happen, you've already learned what type of
element it is - you needed that information to resolve selectors.  You
might not keep it around for easy reference during transition-time,
though.  That seems fixable, though.  You could just have a "virtual"
property, applied to all the replaced elements, that says whether
they're replaced or not.

I could probably do what you asked for too, though.  I'd just need to
be careful and make sure that "main size property" is defined for
elements that aren't flexbox items.

~TJ

Received on Saturday, 7 April 2012 00:30:43 UTC