Re: [css3-flexbox] change flex from script

On Tue, Nov 8, 2011 at 1:20 PM, Alex Mogilevsky <> wrote:
> Suppose I am writing a script that wants to only change flexibility on some
> flexbox items but not their preferred size.
> For example, an element might have style.width = “flex(1 314px)” set
> previously. Not sure how.
> Now, I want to change that to “flex(0 314px)”. How do I do that?
> style.width will return a string with flex() notation. The only way to get
> to old preferred width that I can think of is parsing flex() in script.
> Assuming that the value in style.width is always normalized (has length last
> and has “0px” even if default is used) parsing is not that hard, but still
> doing that is a hassle.
> I am not sure how important it is to set flexibility separately, but if
> somebody needs that it is a problem. Not sure what to do about it either.

Yes, right now it requires string parsing, which sucks.  This will be
easier in the Values API.

> Also, how much did we discuss separate cascading of width and flex? With
> flex() it is not possible. Is it important that it is not possible?

I don't think it's important, for the same reason that I combined
width and box-flex originally - people naturally think of flex in
terms of a width value.  I'm sure there are situations where you may
want to change them independently, but there are also situations where
you'd want to change the colors of a gradient while keeping the sizing
the same across several boxes.


Received on Tuesday, 8 November 2011 23:12:33 UTC