[whatwg] comment parsing

Anne van Kesteren fora at annevankesteren.nl
Sat Jan 21 05:17:16 PST 2006

Given the new parsing rules for comments (all those internal discussions...) I
was trying to write some testcases for how they are defined now.

# <p><!-- -- -->PASS<!--></p>

However, from the specification it is not entirely clear what should happen with
<!--></p>. Well, perhaps it is, but then I'd like that to be changed. If we take
the problematic snippet:

# <!--></p>

It seems that per <http://whatwg.org/specs/web-apps/current-work/#marked> "<!--"
starts the comment. It seems that per
<http://whatwg.org/specs/web-apps/current-work/#comment> all characters that
follow and are not a dash have to become part of the comment. Is that correct?

So if I would modify the testcase to say:

# <p><!-- -- -->PASS<!--></p>FAIL

And directly after "FAIL" it is EOF (or a few end tags later) it would never
show up, right?

Given that most browsers show "FAIL" or "<!-->FAIL" for:

# <p><!-->FAIL</p>

A change might be in order. Or perhaps someone explaining to me what I did wrong
when reading the specification.

Anne van Kesteren

More information about the whatwg mailing list