Firefox 3 html comment issue

So, I have a site where there are many places where html comments are written as

I noticed that when you write:

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

Only hello2 is shown. If you do not type a dash 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 do this work as possible without going through the entire site and changing all the comments? By the way, it shows well in all browsers, including firefox 4 and even IE. The problem only occurs on FF 3.6

+6
source share
2 answers

Commentary begins and ends with the sequence -- .

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

means:

  • start comment
  • space
  • K.P
  • space
  • end of comment
  • start comment
  • end of comment
  • start comment
  • end of comment
  • start comment
  • end of comment
  • space bar (no comment!)
  • start comment

There is a reason the HTML spec says :

A common mistake is to include a hyphen line ("---") in a comment. Authors should avoid posting two or more related hyphens inside comments.


Now, is there a way for me to do this work as possible without going through the entire site and changing all the comments?

Not.

By the way, it is displayed perfectly in all browsers, including firefox 4 and even IE. The problem only occurs on FF 3.6

Too many bad authors, depending on errors in how some invalid browser comments meant that browser vendors abandoned attempts to properly implement comments.

Mozilla has not abandoned Firefox 3.6

+27
source

This use of dashes in HTML comments causes unpredictable behavior. See https://bugzilla.mozilla.org/show_bug.cgi?id=2749 for more information on differences in parsing HTML comments. (Source http://www.hixie.ch/tests/evil/mixed/comments-evil.html is a very good example)

I recommend using some script or Find & Replace server function in your text editor to replace the dash in comments with equal signs or another character.

0
source

Source: https://habr.com/ru/post/890258/


All Articles