Newlines between comments after root (detailed review of Writing HTML documents)

(This is part of my detailed review of the Writing HTML documents section.)

The spec has the following note:

    Note: Space characters before the root html element will be dropped
    when the document is parsed; space characters after the root html
    element will be parsed as if they were at the end of the html element.
    Thus, space characters around the root element do not round-trip. It is
    suggested that newlines be inserted after the DOCTYPE and any comments
    that aren't in the root element.

This is not correct; space characters after the root html element will be  
parsed as if they were at the end of the *body* element.

Also, if you insert newlines after comments that occur after the root  
element then you will increase the number of newlines in the body element  
for each round-trip. The rest of this section goes to great lengths to  
make sure that whitespace round-trips correctly, so perhaps this  
suggestion should be limited to comments before the root element to be  
consistent.

-- 
Simon Pieters
Opera Software

Received on Saturday, 1 September 2007 16:37:59 UTC