The closing delimiters of a nested HTML comment are ignored

RESOLVED INVALID

Status

()

Core
HTML: Parser
RESOLVED INVALID
13 years ago
12 years ago

People

(Reporter: Thierry, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

In the page at http://www.tjkdesign.com/lab/mozBug.asp, the text "This text will
be blue if the rule has been applied" should be blue. In Mozilla, the style is
ignored.

Reproducible: Always

Steps to Reproduce:
1. Include a HTML comment in the markup
2. Nest another HTML comment in it

Actual Results:  
Markup between the nested comment and the closing delimiters of the first one is
ignored

Expected Results:  
Mozilla should "see" any content that comes after the _first_ closing delimiters
sequence.

Comment 1

13 years ago
This whole block is seen as one comment, as you also can see in DOM Inspector.

<!--[if IE]>
<!-- The closing delimiters of this comment is ignored by Gecko-based browsers -->
<style type="text/css">
.notGecko {color:blue}
</style>
<![endif]-->

You´ve put an HTML comment into an IE conditional comment, expecting that this
would break the IE comment? 
Comments in HTML are complicated, and can´t be nested:
http://www.htmlhelp.com/reference/wilbur/misc/comment.html

<!--[if IE]>       : This <!-- starts the comment
<!-- The closing   : The -- is a SGML comment delimiter, and ends the comment
browsers -->       : The -- is a SGML comment delimiter, and starts the comment
again

It works, if you insert a space here: browsers - -> 

imho this bug is invalid, I didn´t find a spec for conditional comments, though
I know it exists somewhere at Microsoft, and I didn´t find a spec for nesting
comments, but I know you´ve got to count the dashes very painstakingly, if you
use more than one in sequence inside a comment. It´s no problem if you use them
always in multiples of four, always ;-)

Comment 2

13 years ago
It's not valid to put -- into the body of a comment according to the spec, see
http://www.w3.org/TR/html401/intro/sgmltut.html#idx-HTML

Also note that conditional comments are not supported in Mozilla.

-> INVALID
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → INVALID
Summary: The closing delimiters of a nested HTML comment is ignored → The closing delimiters of a nested HTML comment are ignored

Comment 3

12 years ago
*** Bug 303019 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.