Closed Bug 303019 Opened 20 years ago Closed 20 years ago

Incorrect handling of nested HTML open comments (<!--).

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 290070

People

(Reporter: eakthecat, Unassigned)

References

()

Details

Attachments

(2 files)

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6 The page http://www.kythra.net/blog/firefox.htm is a snapshot of my blog. It should look like http://www.kythra.net/blog. The only difference is that the snapshot contains the following code: <!-- WebHost4Life.com Code Begin <a href="http://www.WebHost4Life.com/default.asp?refid=MarkHWagner"> <img id="Header1_HeaderAd" src="Skins/Cogitation/Images/WebHosting.gif" alt="Join WebHost4Life.com" border="0" /> </a> <!-- WebHost4Life.com Code End --> The gross formatting problems are a result of there being a "<!--" inside the body of the comment and firefox attempting to parse the second comment opener. The correct behavior when handling nested comments is to ignore everything in a comment until the comment closer (-->) is reached. This is a Firefox-specific bug, I have tested the same code on Mozilla for OSX, and not seen bug. Reproducible: Always Steps to Reproduce: 1. Navigate to any moderately complex page that has a nested HTML open- comments (<!--) Actual Results: Firefox gets confused when seeing nested comment openers (<!--) and comments out HTML outside of the comment; HTML that should be rendered normally. Expected Results: The correct behavior when handling nested comments is to ignore everything in a comment until the comment closer (-->) is reached. Everything after the comment should be rendered as usual.
In standards mode, Firefox emulates tree-like behavior (if you open within comment, you have to close TWO comments to get all comments to close). "<!-- comment <!-- comment -->" still has one more comment to close. So Firefox goes on a hunt for another comment. And it gets one. You have a "-- Unknown" in firefox.htm. Firefox pairs up that dash with the nearest ">", which happens to be a tag (</div> or something). In quirks mode, Firefox will close all comments open as soon as it hits a close comment atom. All in all, fun.
XHTML is XML, and in XML "--" in comment is INVALID. http://www.w3.org/TR/REC-xml/#sec-comments
This is a dupe of bug 290070 Though I guess there'd be a bug older than that...
*** This bug has been marked as a duplicate of 290070 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: