Closed Bug 292267 Opened 20 years ago Closed 20 years ago

double-dash within an HTML comment tag breaks the comment tag

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mozilla, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1

When a double-dash is found inside a comment tag, e.g.

<!-- #BeginLibraryItem "/Library/footer--main.lbi" -->

Firefox drops the "<!" from the front and renders the remainder of the comment
tag visibly on the page, e.g.

-- #BeginLibraryItem "/Library/footer--main.lbi" -->

Changing the "--" in the middle, e.g. footer-main.lbi, fixed the rendering
problem. My guess would be that Firefox's tag parser is looking for the next
occurrence of "--" instead of "-->" to determine when the tag is "closed".

Reproducible: Always

Steps to Reproduce:
1. Insert an HTML comment field into an HTML file. In the text surrounded by the
start and end comment indicators ("<!--" and "-->", respectively) insert a
double dash "--". 
2. View the file in FireFox

Actual Results:  
The leading part of the comment tag disappears from the view file, exposing
whatever text was inside the comment tag.

Expected Results:  
Not rendered the comment tag at all. Firefox is mis-parsing the comment tag
contents in violation of HTML.
Attached file testcase
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050428
Firefox/1.0+

Confirming

(looking for a dupe)
acc to https://bugzilla.mozilla.org/show_bug.cgi?id=144600#c1
it's illegal to use characters inside a comment in html


W3C:
3.2.4 Comments

HTML comments have the following syntax:

<!-- this is a comment -->
<!-- and so is this one,
    which occupies more than one line -->

White space is not permitted between the markup declaration open delimiter("<!")
and the comment open delimiter ("--"), but is permitted between the comment
close delimiter ("--") and the markup declaration close delimiter (">"). A
common error is to include a string of hyphens ("---") within a comment. Authors
should avoid putting two or more adjacent hyphens inside comments.

->INVA
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: