|
Posted by David E. Ross on October 13, 2007, 12:51 pm
Please log in for more thread options
On 10/12/2007 11:29 PM, Jukka K. Korpela wrote [in part]:
> Scripsit Stan Brown:
>
>> Fri, 12 Oct 2007 21:59:51 +0300 from Jukka K. Korpela
>>> Actually this misbehavior of IE was introduced by IE 7, ...
>>> other entity references and character references using hexadecimal
>>> notation are not recognized but taken literally.
>> Do you mean they are not recognized at all, or not recognized unless
>> they have the terminating semicolon?
>
> The latter.
>
> I cannot help comparing this issue with Reason #4 in "4 Reasons to Validate
> your HTML":
>
> "Reason #4: Netscape 4.0
> Netscape 4.0 began requiring the terminating semicolon on entities where
> previous versions often had not. For example, some HTML tutorials show their
> expertise with <P>Foo in examples, which Netscape 4.0 shows literally
> while previous versions had shown "<P>Foo". Again, valid HTML worked fine in
> all versions of Netscape."
The quoted example is one in which Section 5.3 of the HTML 4.01
specification requires semi-colons because the entity references are NOT
followed by a blank space, line-end, or tag. After all, is the first
entity reference < or is it <P? Is the second > or >Foo?
Section 5.3 strongly implies that the semi-colon is optional only when
the entity reference can be decoded unambiguously without it.
The situation that prompted my original post that started this thread
had a blank after the entity reference, thus providing the necessary
unambiguity. The W3C validator at <http://validator.w3.org/> accepted
it as valid.
I hand-code all my HTML. I (almost) always code entity references with
semi-colons. I consider this one instance to be a typo. I did not
catch it via the W3C validator because it was indeed valid. I did not
catch it while proof reading the rendered Web page because SeaMonkey
correctly rendered it. I only caught it when a friend using IE asked
what &mdash is; IE failed to correctly render it and instead exposed it.
I started this thread merely to warn others that they should NOT treat
the semi-colon as optional.
--
David E. Ross
<http://www.rossde.com/>
Natural foods can be harmful: Look at all the
people who die of natural causes.
|