Closed Bug 599619 Opened 14 years ago Closed 14 years ago

HTML Comment Parsing broken

Categories

(Core :: DOM: HTML Parser, defect)

1.9.2 Branch
x86
Windows 7
defect
Not set
critical

Tracking

()

RESOLVED DUPLICATE of bug 214476

People

(Reporter: bugzilla, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10

Parsing of HTML comments appears different with 3.6.10 than with 3.6.9.  Specifically, closing comment tags are being ignored in the following form:

<!------- comment -------->

This may have something to do with the number of "-" in the closing portion of the comment.  When this occurs, changing to 

<!-- ----- comment ------ -->

does not fix.  Only by removing the extra dashes and reverting to 

<!-- comment --> 

is the comment closing consistently.  This behavior is not present in Chrome, IE (of 8 or earlier variants) or Safari/webkit.


Reproducible: Always
darn it - cannot reproduce in simple test form.
the issue appears to be with the number of dashes not matching between the comment open tag and the comment closing tag.  If the count of dashes from the opening to closing is not within one, sections of code are commented out unexpectedly.

see code below:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
		<title>Untitled Document</title>
	</head>
	<body>
		<div>Comment below - 2 opening, 2 closing</div>
		<!-- Comment -->
		<div>Comment below - 2 opening, 3 closing</div>

		<!-- Comment --->
		<div>Comment below - 2 opening, 4 closing</div>
		<!-- Comment ---->
		
		<div>Comment below - 3 opening, 2 closing</div>
		<!--- Comment -->
		<div>Comment below - 3 opening, 3 closing</div>
		<!--- Comment --->
		<div>Comment below - 3 opening, 4 closing</div>
		<!--- Comment ---->
		<div>Comment below - 3 opening, 5 closing</div>
		<!--- Comment ----->
		
		<div>Comment below - 4 opening, 2 closing</div>
		<!---- Comment -->
		<div>Comment below - 4 opening, 3 closing</div>
		<!---- Comment --->
		<div>Comment below - 4 opening, 4 closing</div>
		<!---- Comment ---->
		<div>Comment below - 4 opening, 5 closing</div>
		<!---- Comment ----->
		<div>Comment below - 4 opening, 6 closing</div>
		<!---- Comment ------>

		
		<div>Comment below - 2 opening, 2 closing</div>
		<!-- Comment -->
		
	</body>
</html>
Ermm, are you really sure about
3.6.9 ok
3.9.10 fails?
Since there were only 1-2 Checkins in that 3.6.10.
Version: unspecified → 1.9.2 Branch
... and moreover, for all 1.9.2/3.6.x Releases 
"html5.enable" has to be set "false".
3.6.9 removed the ability to enable the HTML5 parser on the 1.9.2 branch. The problem is not gonna be fixed in the old parser but is fixed in the new parser.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.