firefox rendering and validation bug?
Earlier this week I was testing a site and noticed some weird extra characters being displayed in the page, I checked the html source to see where they were coming from. the characters being displayed were:
-->
ah! easy that’s just an end html comment, I must have left in by accident, but when i checked the source it was not the case, there were no end comment tags that had not been opened by the appropriate begin comment tag. On closer inspection I did notice something funny:
<!--
<tr>
<td>Phone:</td>
<td>--</td>
</tr>
<tr>
<td>Email:</td>
<td> </td>
</tr>
-->
it turns out that the two minus characters were actually ending the html comment, and so the actual end comment tag was seen as extraneous. I thought that was pretty odd, so i checked how things rendered in opera 9.5 - looked fine, IE 7 - looked fine, so then I tried the w3c validator to see if there was anything invalid about having two minus characters inside of an html comment. The validator complained about them - bitterly, so who’s right here? is this merely a parsing bug in the w3c’s validator and the firefox renderer, or are Microsoft and Opera wrong for hiding my mistake?
January 8th, 2008 at 4:50 am
This is an SGML related thing. The following page offers a good explanation.
http://www.howtocreate.co.uk/SGMLComments.html
The short answer is that technically IE and Opera are incorrect.
January 17th, 2008 at 2:09 pm
thanks BigBadaboom, i knew HTML had it’s roots in SGML, so that link was very interesting reading