Standards mode HTML forbids double hyphens in comments.
<!-- This is a perfectly valid comment - I think. -->
<!-- Invalid comment -- definitely. -->
There are three additional restrictions, exemplified by these invalid examples:
<!--> invalid -->
<!---> invalid -->
<!-- invalid --->
Why bother specifying all these little edge cases? In particular, why forbid double hyphens?
[Definition: Comments may appear anywhere in a document outside other markup; in addition, they may appear within the document type declaration at places allowed by the grammar. They are not part of the document's character data; an XML processor may, but need not, make it possible for an application to retrieve the text of comments. For compatibility, the string " -- " (double-hyphen) must not occur within comments.] Parameter entity references must not be recognized within comments.
The grammar does not allow a comment ending in --->
It seems to be a feature of XML included solely to ensure that XML remains compatible with SGML http://www.w3.org/TR/REC-xml/#sec-comments
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With