2010-07-30

Having Two Consecutive Hyphens in XHTML Comments Causes Anomalies in Firefox

Check out my experiment page to see the different side effects this issue causes.

If you're seeing weirdness when having hyphens in your (X)HTML comments, it's most likely because you're using two adjacent to each other, which is a big no-no according to the W3C.

Avoid using hyphens in your comments to avoid the issues... dumb, but required.

I know we're all prone to yell at Mozilla and tell them they're doing it wrong, because all the other latest versions of other browsers will still honor the comments, but Firefox isn't necessarily doing it wrong, because as I understand it, they're allowed by the standard to not honor the comment if there are two adjacent hyphens together.  In one way I think it's good that Firefox doesn't, because it forces we, the web authors, to follow standards.

On the other hand, I think the standard is flawed and that nothing between the start and end of a comment should matter... so part of me wishes Firefox would do like the other browsers and still honor the comments.

Oh well, go the safe route and keep hyphens out of your comments.