Closed Bug 235628 Opened 20 years ago Closed 20 years ago

double hyphen within comment causes comment to display, displayable text hidden

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows ME
defect
Not set
minor

Tracking

()

VERIFIED INVALID

People

(Reporter: richienh, Unassigned)

References

Details

User-Agent:       
Build Identifier: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.6) Gecko/20040113

Including two consecutive hyphens (dash, minus sign) within a comment causes the
text of the comment itself to display and otherwise displayable text to
disappear.  The behavior changes slightly if there is a second comment which
contains any text which appears to be an HTML tag (even if the tag is bogus).

Reproducible: Always
Steps to Reproduce:
1.  Here is a code fragment which shows the problem:

Here is the first way to see the problem<br>
<!-- This is a comment showing the problem of the -- double hyphen -->
<br>This text is hidden by the double hyphen bug<br>
<!-- <p>This text magically appears even though it's a comment -->

Here is a different way to see the problem<br>
<!-- A second comment showing the problem -- differently -->
<br>This text appears regardless because there's no tag in the next comment<br>
<!-- This text contains no HTML tag, hence doesn't display -->
Even a bogus tag (for example, &lt;bogus&gt;) makes a difference

Actual Results:  
Some text one expects to see is hidden.  Some text one expected to be invisible
because it occurs within a comment is displayed.

The simple workaround is to not have hyphens in sequence, either by removing the
second hyphen or by separating them with a space.

Expected Results:  
Hide all text within a comment.  Display text outside comments.
> The simple workaround is to not have hyphens in sequence

Which is what the HTML spec clearly says authors should do.  The reason is that
in HTML "--" is that character sequence that both starts and ends comments.  In
quirks mode, we treat "<!--" and "-->" as the start/end sequences, but in
standards mode, which your test pages must  be triggering, we actually do
correct comment parsing.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Status: RESOLVED → VERIFIED
*** Bug 305122 has been marked as a duplicate of this bug. ***
*** Bug 361731 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.