Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: open
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!
Firefox will mess up url string displays on me all the time as it will look at page.php?this=that&sub=123&eat=myshorts
it will think the '&sub' is the special character of '⊂'
So now when I write strings, create variables I have to think to myself 'Is this similiar to a special HTML entity?'
Check the resulting source code in Firefox and you will see:
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
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:
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. ;)