Re: [css3-text] Feature request: "white-space: ignore"

On Tue, Dec 18, 2012 at 2:55 PM, Zack Weinberg <zackw@panix.com> wrote:
> If the attached test case is viewed on a computer with both Arial and
> Trebuchet MS installed, you should see that the boxes marked "label
> one" and "box one" are on the same line, whereas the box marked "box
> two" has been pushed onto a new line below "label two".  This is
> because there is a whitespace node in between each pair of boxes
> (which are 'inline-block') in the DOM, the second container is being
> drawn with Trebuchet MS, and its space character is ever so slightly
> too wide to fit in the gap left between the boxes.  (Identical
> behavior observed with Firefox, Chrome, and IE9.  Safari and Opera
> don't push "box two" onto a new line, perhaps because they round
> things differently.)
>
> The whitespace node comes from pretty-printing of the HTML source and
> was not intended to be significant.  It would be nice if there were a
> way to tell the renderer not to allocate any space for such
> unintentional nodes.  A "white-space" value seems like the logical
> place to put that way; I suggest "white-space:ignore".  There is a
> slight awkwardness in that 'white-space' inherits, so it would be
> necessary in this example to mark the inner divs as white-space:normal
> explicitly, but I think we can probably live with that.

This is covered by the 'text-space-collapse' property, experimentally
specced in Text 4:
<http://dev.w3.org/csswg/css-text-4/#white-space-collapsing>  In
particular, the 'discard' value.

There's an issue in the spec already that points out how several of
the values don't work well with this being inherited.  We haven't
given Text 4 much love yet, so there hasn't been much thought into how
to solve that.

~TJ

Received on Friday, 29 March 2013 17:20:36 UTC