Page is a not externally linkable
- Browsers
-- Opera Browser Usage and Support
---- FF, Opera autocorrect html enties with missing semicolon


encyclo - 2:45 am on Nov 25, 2005 (gmt 0)


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:

[w3.org...]
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. ;)


Thread source:: http://www.webmasterworld.com/opera_browser/401.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com