Whitespace at start of elements

Simon Middleton (smiddleton@acorn.com)
Tue, 05 Aug 1997 16:54:27 +0100 (BST)


Date: Tue, 05 Aug 1997 16:54:27 +0100 (BST)
From: Simon Middleton <smiddleton@acorn.com>
To: www-html@w3.org
Message-ID: <Marcel-1.26-0805155427-868LJLo@om92.acorn.co.uk>
Subject: Whitespace at start of elements


Can someone explain the follolwing to me, please? From the HTML 4 draft
section 7.3 (Text)

> A line break occurring immediately following a start tag should be discarded,
> as should a line break  occurring immediately before an end tag. This applies
> to all HTML elements without exceptions. In  addition, for all elements
> except PRE, a sequence of contiguous white space characters such as spaces, 
> horizontal tabs, form feeds and line breaks, should be replaced by a single
> word space.
> 
> <P>
>   This example shows a paragraph and a list.
> </P>

> may be rewritten (by omitting end tags) and laid out differently (by using
> less white space):
> 
> <P>This example shows a paragraph and a list.
> 
> but should be rendered identically by a user agent.

The question is, if you discard a newline after a start tag and collapse
whitespace surely the example should become

<P> This example shows a paragraph and a list.

ie a paragraph with a space at the start.

Presumably there is some other bit of SGML behaviour that dictates that the
collapsed whitespace is itself dropped? If so should a note be added because
as it stands the equating of the two doesn't make sense.

Simon.
-- 
Simon Middleton, Senior Software Engineer, Internet Technologies
Acorn Computers Ltd                           Tel: +44 (0) 1223 725576
Acorn House, 645 Newmarket Road               Fax: +44 (0) 1223 725676
Cambridge, CB5 8PB, United Kingdom            WWW: http://www.acorn.com/