Whitespace significance. To standard or not to standard or 'don't change my HTML again!'

Have a look at this bug. In fact, it is not that we again munge your HTML. It is that we are trying to preserve whitespace and ensure correct page rendering. Why? Let's look at the standard first.

B.3.1 Line breaks

SGML (see [ISO8879], section 7.6.1) specifies that a line break immediately following a start tag must be ignored, as must a line break immediately before an end tag. This applies to all HTML elements without exception.

The following two HTML examples must be rendered identically:

 <P>Thomas is watching TV.</P> 
 <P> Thomas is watching TV. </P> 

So must the following two examples:

 <A>My favorite Website</A> 
My favorite Website

As you see, CRLF after open atag and before closing tag are not significant. Well, that's not quite what happens in a real world... I created the following HTML:

 <a href="http://www.microsoft.com">
<a href="http://www.microsoft.com">
<a href="http://www.microsoft.com">Foo</a>
 Here is how IE6 renders the fragment:


Here is how FireFox does it:


Interesting, but FireFox renders first line differently (note the longer underline). Opera does the same. Which brings the question: should we follow the letter of the standard and treat










as the same or should we follow real world rendering and treat them differently? The problem is that upon switch from Design to Source view some HTML formatting may change which may be perceived as that dreaded 'oh, no, my HTML is changing AGAIN! '.