DeutschEnglish

Submenu

 - - - By CrazyStat - - -

22. April 2015

HTML5: why is my comment a ‘bogus comment’!?

Filed under: Uncategorized — Tags: , , , , — Christopher Kramer @ 12:52

I checked the validity of an HTML5 document (using the HTML Validator extension for Firefox, which I highly recommend) and found an error about a “bogus comment”. The comment looked normal:

<!–– some comment ––>

Then I read the HTML5 specification and found out that the bogus comment state instead of the “normal” comment state is entered if after “<!”, the parser cannot find two dashes. I remembered that I had copied the comment from the web and not typed it myself, so I deleted the –– and typed them manually. Looking closely, you can see the difference:

<!–– some comment ––>
<!-- some comment -->

After that, the bogus comment error was gone.

So the reason was that the – signs were not “normal”, but some other characters for longer dashes that look similar. So whenever you see a “bogus comment”, try to type the comment tags yourself…

Hope this helps somebody.

Recommendation

Try my Open Source PHP visitor analytics script CrazyStat.

6 Comments »

  1. Thanks a lot!
    I was very angry at the html5, but it wasn’t its fault.

    Comment by waterjess — 19. April 2019 @ 08:21

  2. I appreciate, result in I discovered exactly what I was
    looking for. You’ve ended my four day lengthy hunt!
    God Bless you man. Have a nice day. Bye

    Comment by Kelly — 15. July 2019 @ 04:44

  3. And it’s -still- a very useful post in 2020!

    Comment by Jim — 13. March 2020 @ 17:06

  4. And it’s -still- a very useful post in 2021!

    Comment by David — 15. February 2021 @ 10:49

  5. And it has been – still – a very useful post also in 2022! HI

    Comment by hb9tza — 6. February 2022 @ 16:59

  6. 2022- Still useful! My comment isn’t bogus!

    Comment by Matthew K — 10. February 2022 @ 17:38

RSS feed for comments on this post. TrackBack URL

Leave a comment