This is just a small note -- but I was recently embarrassed by putting a typo up on a final version of a critical web page for a client.
I intended to use — but I left off the final semicolon. I never noticed it because Firefox and Opera both autocorrected and showed the m-dash glyph, and after checking the page template in IE, I never thought to proofread the text in many browsers.
I honestly wish that browsers would NOT auto-correct. That was the direction IE took with all kinds of html errors that eventually gave us tag soup. If I make a mistake, let me see it!
Try making a mistake such as leaving off a closing bracket on a tag: [b]<body[/b] <p>text here</p>
Check the resulting source code in Firefox and you will see:
[b]<body[/b] ><p>text here</p>
The browser is showing how it handles broken markup by adding a closing bracket when it encounters a new opening bracket. The page displays as expected.
Is good error-handling a bad thing? In the majority of cases I think that error-handling is a vital part of the success of the format: markup is designed to be sloppy, that unknown tags or attributes can't break things. Without wanting to open the
application/xhtml+xml can of worms, if the error-handling by browsers was deficient then HTML would be nowhere as popular as it is today.
With this particular example, however, there is not actually an error which is being corrected - Firefox and Opera are both doing the right thing by displaying the character entity. See:
Note. In SGML, it is possible to eliminate the final ";" after a character reference in some cases (e.g., at a line break or immediately before a tag). In other circumstances it may not be eliminated (e.g., in the middle of a word). We strongly suggest using the ";" in all cases to avoid problems with user agents that require this character to be present.
Try it with a validator:
&mdash abd &sup are valid SGML entities, so the browser is handling it correctly if it displays the glyph even if leaving off the final semi-colon is very bad practice. You're being caught out by a broken browser if the glyph is not displayed, not the other way round. ;)