Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox 3 html commenting issue

So I have a site where there are a lot of places where html comments are written as

I noticed that when you write:

            <div>hello</div>
            <!-- COMMENT --------------- //-->
            <div>hello2</div>

Only hello2 shows. If you don't type in the dashes at the end:

        <div>hello3</div>
        <!-- COMMENT --------------- -->
        <div>hello4</div>

then both hello3 and hello4 are printed. Now, is there a way for me to make this work how it is suppposed to without going through the whole site and changing all the comments? BTW it shows fine in all browsers, including firefox 4 and even IE. The problem only occurs on FF 3.6

like image 842
odle Avatar asked Jun 10 '11 21:06

odle


1 Answers

The comment is started and finished by the sequence --.

<!-- COMMENT --------------- //-->

means:

  • start comment
  • space
  • COMMENT
  • space
  • end comment
  • start comment
  • end comment
  • start comment
  • end comment
  • start comment
  • end comment
  • dash space slash slash (outside a comment!)
  • start comment

There is a reason that the HTML specification says:

A common error is to include a string of hyphens ("---") within a comment. Authors should avoid putting two or more adjacent hyphens inside comments.


Now, is there a way for me to make this work how it is suppposed to without going through the whole site and changing all the comments?

No.

BTW it shows fine in all browsers, including firefox 4 and even IE. The problem only occurs on FF 3.6

Too many bad authors depending on bugs in how some browsers mishandled comments meant that browser vendors have given up trying to implement comments correctly.

Mozilla didn't give up until after Firefox 3.6

like image 77
Quentin Avatar answered Oct 21 '22 05:10

Quentin