Comments with multiple dashes and no ending space fool the HTML parser

RESOLVED DUPLICATE of bug 233270

Status

()

RESOLVED DUPLICATE of bug 233270
12 years ago
12 years ago

People

(Reporter: tegan, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2

HTML comments with multiple dashes and no ending space fool the HTML parser.

An example of a bad comment:
<!---------------------------------END HEADER ------------------------------------------>

Example of a good comment:
<!---------------------------------END HEADER ----------------------------------------- ->

The bad comment will cause the HTML parser to think everything below it is commented, until the next comment is started. Lots of web site developers use comments like this to signify sections of their site.

Reproducible: Always

Steps to Reproduce:
1. Create an HTML file
2. Wrap the contents in comments like the above "bad comment"
3. View the page. The page will be blank, and in View Source everything between the comments will be green (meaning commented out).
Actual Results:  
The HTML parser thinks that chunk of HTML is commented out, when it's not.

Expected Results:  
It should realize that the comment was ended correctly with a ->, even if there is no space preceding the ->, it's still a valid comment ending.
(Reporter)

Comment 1

12 years ago
Updated the URL with a test page. You can go there to see the issue. You will notice the page is blank, and if you view the page source, you will see the page content (an unordered list) is commented out.

Comment 2

12 years ago
This looks like bug 233270 to me.  Please check you agree, and dupe if you do.
(Reporter)

Comment 3

12 years ago
I agree it's a dupe, and will mark it as such, but I think the issue should be revisited. I understand compliance with SGML, but this isn't SGML, it's HTML and in this case it's XHTML. I understand standards conformance, but I think it can be taken to far. This is one of those cases, in my mind. As a developer, I can work around this, but it's a pain to train designers that "Hey, -- in a comment breaks FireFox and FireFox only, don't do it". I have marked it as a dupe.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 233270
You need to log in before you can comment on or make changes to this bug.