As a web developer, you sometimes see really weird problems like the one I saw today.
In HTML, how do you add a comment?
You'd do this --
<!-- This is a comment -->
and you'd be right of course, but what if you did this --
<!-- This is a comment -- at least I think it is! -->
Is that a comment? Well, sort of. In the HTML 4.0 specification, "--" or two hyphens is considered the comment close delimiter whereas ">" is considered to be the markup declaration close delimiter.
Here's the explanation directly from the spec --
White space is not permitted between the markup declaration open delimiter(""). A common error is to include a string of hyphens ("---") within a comment. Authors should avoid putting two or more adjacent hyphens inside comments.
Information that appears between comments has no special meaning (e.g., character references are not interpreted as such).
Note that comments are markup.So, what actually happens when you use the hypens in the middle of a comment? Here's an example --
If you're using Firefox, you'd see this --
The comments are visible. On any other browser, IE, Safari or Opera, you'd see a normal page --
So, using hyphens in an HTML comment breaks pages on Firefox. Keep that in mind the next time you put in a comment.
Note that in our example, we're specifying a HTML 4.01 DTD. We're using a "strict" DTD, but the problem would still occur if you'd specify a "transitional" or "frameset" DTD.
If you don't specify the HTML 4.01 DTD, you won't see this problem in Firefox.
Additional information and discussion is found on Ben Buchanan's the 200ok weblog.