W3C home > Mailing lists > Public > www-html@w3.org > April 2004

TEXTAREA and white space, CR

From: <guenther.grau@ubs.com>
Date: Thu, 22 Apr 2004 12:07:26 +0200
Message-ID: <388097591E4F5548A6DBC2A777FDB5BC0151E53A@s01b1f4m.flur.zuerich.ubs.ch>
To: <www-html@w3.org>

Hi,

I have a question regarding TEXTAREA and white space, in particular
CRs.

I'd like to display a text that starts with a CR in a TEXTAREA.

Reading the HTML-4.01 I find in section 9.1:

[...]
Line breaks are also white space characters.
[...]
For all HTML elements except PRE sequences of white space separate
"words". 
[...] 
Note that a sequence of white spaces between words in the
source document may result in an entirely different rendered inter-word
spacing 
[...] 
In particular, user agents should collapse input white
space sequences when producing output inter-word space.
[...]
In order to avoid problems with SGML line break rules, and
inconsistencies among extant implementations, authors should
not rely on user agents to render white space immediately after
a start tag or immediately before an end tag.

So, what should conforming HTML look like to display a text starting
with a CR in a TEXTAREA?

<textarea>

test
</textarea>

seems to work for IE6/NS7, but doesn't in Opera 7.11.

And, as a more general note, aren't user agents supposed to
collapse all sequences of white spaces also in a textarea
according to section 9.1, making it impossible to display
a preset text in a TEXTAREA that contains multiple spaces?

<textarea>start                       end</textarea>

should render as a textarea with the following text:

start end


Reading section 17.7, TEXTAREA it says:

[...] User agents should use the contents of this element as the initial
value of the control and render this text initially.

but section 9.1 above clearly states that _only_ PRE conserves
sequences of white space. For all other tags user-agents should
collapse the white space.

Thanx for any clarifications on this,

  Guenther
Received on Thursday, 22 April 2004 06:11:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:00 GMT