W3C home > Mailing lists > Public > www-style@w3.org > November 2011

Re: [css3-flexbox] change flex from script

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 8 Nov 2011 15:11:37 -0800
Message-ID: <CAAWBYDBv6TOOgUH8i9cwHow=UV8K4DsQn3d8YW4jFWTno0RQ0A@mail.gmail.com>
To: Alex Mogilevsky <alexmog@microsoft.com>
Cc: "www-style@w3.org list" <www-style@w3.org>
On Tue, Nov 8, 2011 at 1:20 PM, Alex Mogilevsky <alexmog@microsoft.com> 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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:07 UTC