Re: [css3-flexbox] handling whitespace between items in a flexbox (with interesting values of "white-space" property

On 03/22/2012 12:00 AM, Daniel Holbert wrote:
> Hi www-style,
> 
> Currently, I don't believe the spec makes any mention of how to handle
> whitespace between flexbox items.

More specifically -- what should happen when we have "white-space: pre",
& other interesting (non-"normal") values of "white-space"?

CSS 2.1 details how whitespace is processed in block and inline
layout[1] and in tables[2], but whitespace that's directly inside of a
flexbox is a separate beast that the Flexbox spec needs to explicitly
handle, IMHO.

PROPOSAL:
I'd argue that the "white-space" property should make flexboxes treat
whitespace as follows:

 - For the values 'normal', 'nowrap', and 'pre-line', a stretch of of
whitespace is *insufficient* to generate an anonymous flexbox item.

 - For the values 'pre' and 'pre-wrap': a stretch of whitespace is
*sufficient* to generate an anonymous flexbox item.

DISCUSSION/JUSTIFICATION:
The first group of values (normal/nowrap/preline) all have definitions
that begin...
{{
   "This value prevents user agents from collapsing sequences of white
space"
}}[3]
...while the second group of values (pre/pre-wrap) all have descriptions
that begin...
{{
  "This value prevents user agents from collapsing sequences of white
space."
}}[3]

So, the idea behind my proposal is that when a user-agent is in a
"collapse whitespace" mode, we'll prevent whitespace from triggering
anonymous flexbox items.  Otherwise, we let it trigger anonymous flexbox
items.

I think the only point of potential contention might be the behavior of
'pre-line', for which CSS2.1 says "lines are broken at preserved newline
characters" (but whitespace is otherwise collapsed).  With that value,
one could argue that since newlines are preserved, we should create an
anonymous flexbox item around whitespace if that whitespace contains a
newline.  However, that behavior doesn't seem more confusing than useful
to me, and I don't think it merits the special-case code that it'd require.

Thoughts?
~Daniel

[1] http://www.w3.org/TR/CSS21/text.html#white-space-model
[2] http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes
[3] http://www.w3.org/TR/CSS21/text.html#white-space-prop

Received on Tuesday, 27 March 2012 00:34:37 UTC