W3C home > Mailing lists > Public > www-validator@w3.org > November 2017

Re: malformed comment report

From: David Dorward <david@dorward.me.uk>
Date: Mon, 20 Nov 2017 11:37:46 +0000
To: "Andrew Teal" <andrew.teal@zen.co.uk>
Cc: www-validator@w3.org
Message-ID: <DE394330-1721-46FE-B2FD-A8207D5F939E@dorward.me.uk>
On 17 Nov 2017, at 15:43, Andrew Teal wrote:

> I added  correct comment tags, <!-- /comment/ -->, to a section of an 
> existing document, which unfortunately contained double hyphens: -- 
> (nb no <! or >)
>
> The validator complained, until I took out one of the hyphens.
>
> It needs to look for the whole tag!


See [the specification][1]:

Comments must start with the four character sequence U+003C LESS-THAN 
SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS 
(<!--). Following this sequence, the comment may have text, with the 
**additional restriction** that the text must not start with a single 
">" (U+003E) character, nor start with a U+002D HYPHEN-MINUS character 
(-) followed by a ">" (U+003E) character, **nor contain two consecutive 
U+002D HYPHEN-MINUS characters (—)**, nor end with a U+002D 
HYPHEN-MINUS character (-). Finally, the comment must be ended by the 
three character sequence U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, 
U+003E GREATER-THAN SIGN (-->).

The validator is correct to report the error.

[1]: https://www.w3.org/TR/html5/syntax.html#comments
Received on Monday, 20 November 2017 11:38:10 UTC

This archive was generated by hypermail 2.3.1 : Monday, 20 November 2017 11:38:13 UTC