W3C home > Mailing lists > Public > www-style@w3.org > August 2002

Re: CSS2.1: \A and white-space

From: Coises <Randy@Coises.com>
Date: Sun, 25 Aug 2002 02:37:31 -0700
To: www-style@w3.org
Message-ID: <eb4hmucti77guu3cs6a10cnfqggldno3n7@4ax.com>

[Fri, 23 Aug 2002 08:55:36 -0400] fantasai:
>After all, \A is just an escape sequence that means "newline". CSS2.1,
>however, seems to override that expectation with the wording of its \A
>explanation and the following example.

This part is not changed from CSS 2.
However, it seems to be difficult to find a browser that gets it right.

IE doesn't implement :before and :after at all.

Opera gets it mostly right: it interprets \xxxxxx sequences as Unicode
characters and it doesn't treat &-prefixed strings as entity references;
but it fails to interpret "\A" as a new line at all: it just displays
a substitution character (the character, usually a box, that's displayed
for a code point that has no glyph in the requested font).

From what you wrote, I gather that Mozilla also applies the white-space
property to data in the content property, but does treat \A as a newline
character.  Does it properly recognize \xxxxxx sequences as Unicode
characters (*not* as code points from the document character set) and avoid
recognizing entity references (e.g., "&lt;" is 4 characters, not one)?

The description of the white-space property here:
explains what is expected in regard to \A characters in generated content.
The clear reason for the choice is so that a <br /> element can be defined
by a style sheet (as in <http://www.w3.org/TR/CSS21/sample.html>, for
example) --- this is of little importance for HTML, but I imagine it is
quite significant for use with XML.

There is one obvious error in the present CSS 2.1 definition of the
white-space property --- the change noted here:
has not yet been incorporated in the main text.

I think there is a more subtle error as well.  Note that:
||   This property declares how whitespace inside the element is handled.
and links "whitespace" to:
which defines white space in CSS.

Shouldn't the "whitespace" which is affected by the "white-space" property
be "whitespace" as defined by the document language, not by CSS?

I also think it should be clarified how other white space is to be handled
in generated content: one might expect the behavior to be analogous to that
of newline characters, but it isn't specified.  (This becomes more
problematic, at least in principle, if you accept my contention that the
document language --- not CSS --- must define the "whitespace" that is at
issue here.)  I can think of two simple ways to resolve these ambiguities;
it's not clear to me which is preferable:

1. Now that it is agreed that the white-space property applies to all
elements (not just block-level elements), change the sample style sheet
for HTML 4.0 to specify:
     br:before       { content: "\A" ; white-space: pre}
and change the description of the white-space property to remove any
suggestion that generated content should be treated differently than
document content.

2. Specify that generated content is not affected by the white-space
property: it is always treated as if "white-space: pre" were in effect.

My guess is that the first choice would be simpler for browser writers,
while the second preserves compatibility with the CSS 2 specification
(though nobody seems to implement that correctly anyway).
Randall Joseph Fellmy aka Randy@Coises.com
Received on Sunday, 25 August 2002 05:38:03 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:03 UTC