Closed Bug 543064 Opened 15 years ago Closed 15 years ago

Having two hyphens together inside a comment breaks said comment

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 102127

People

(Reporter: tracker1, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729) Below is markup to re-create issue, if I remove the extra hyphen from inside the comment it will render properly. <!DOCTYPE html> <html> <head> <title>Test</title> </head> <body> <table> <tbody> <tr> <th><label>Test1 - shows</label> <td> <div id="someId" class="DatePicker"> item 1 <!-- comment -- more info --> </div> </td> </tr> <tr> <th><label>Test2 - breaks</label> <td> <div id="otherId" class="DatePicker"> item 2 <!-- some comment -- more info --> </div> </td> </tr> <tr> <th><label>Test3 - shows</label> <td> <div id="otherId" class="DatePicker"> item 3 <!-- dude -- the comment is displaying --> </div> </td> </tr> </tbody> </table> </body> </html> Reproducible: Always Steps to Reproduce: The HTML used in the Details will allow you to reproduce the issue. Odds are it's the detection of the end of an html comment block that breaks the visual display. <ul> <li> Test1 - shows <!-- comment -- 1 --> </li> <li> Test2 - hidden <!-- comment -- 2 --> </li> <li> Test3 - WTF!? <!-- comment -- 3 --> </li> </ul> Actual Results: Some items are completely removed from the rendered DOM tree, and other items will show the comments within the display itself. Expected Results: comments are hidden, and other elements show up properly. I know it's generally bad form to have divs in tables, however the markup for the target page needs to work well in IE6 (bane of my existence), so the Table is the most direct approach. The markup itself is rather simplified from what I'm actually using.
This is not valid html. From http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.4 : "A common error is to include a string of hyphens ("---") within a comment. Authors should avoid putting two or more adjacent hyphens inside comments." However ... HTML 5 will change this behavior.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.