Welcome to WebmasterWorld Guest from 54.221.49.52

Forum Moderators: open

Message Too Old, No Replies

FF, Opera autocorrect html enties with missing semicolon

     

tedster

8:27 pm on Nov 24, 2005 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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!

otc_cmnn

9:48 pm on Nov 24, 2005 (gmt 0)

10+ Year Member



Yup p*sses me off too.

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?'

Annoying...

encyclo

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

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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. ;)

tedster

4:31 am on Nov 25, 2005 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You're being caught out by a broken browser if the glyph is not displayed

Wow -- thanks. Seems there is always some corner of html/css that is new to me. Interesting to learn that IE is broken here. I thought, for once, it was doing the right thing.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month