- incorrect parsing of HTML comments?



Tech Evangelism
16 years ago
3 years ago


(Reporter: Daniel Steinberger, Unassigned)


Firefox Tracking Flags

(Not tracked)





16 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:0.9.7+)
BuildID:    2002010303

on the page i ran across a comment on the
bottom of the page, stating that my browser could not parse comments correctly.
after reviewing the HTML source i think i *might* be true.

Reproducible: Always
Steps to Reproduce:
1. visit
2. scroll to the very bottom of the page

Actual Results:  seeing the text:
Did you know that your Browser is buggy: it can't parse comments correctly.

Expected Results:  not seeing text

i checked the HTML source, a sniplet of it is
<!--> Did you know that your Browser is buggy: it can't parse comments
correctly. -->

than i went to w3c - -
checking for the definition. it states:
White space is not permitted between the markup declaration open delimiter("<!")
and the comment open delimiter ("--"), but is permitted between the comment
close delimiter ("--") and the markup declaration close delimiter (">"). A
common error is to include a string of hyphens ("---") within a comment. Authors
should avoid putting two or more adjacent hyphens inside comments.

and so there is IMHO a lack of definition here. is this comment misinterpreted
or not? i'm not sure myself! it'll be fine for me, to see this one become
INVALID, _if_ you can explain to me, that it _is_ so, lerying on the HTML

Comment 1

16 years ago gives a good description
of some of the issues involved, but it's too late at night, and my brain hurts,
so I'm going to ask the opinion of someone who can probably work this out better
than me.  

Boris, any idea what's going on here?

We're in strict mode, I think.  The comment at the top has extra hyphens, but
they look carefully counted and cancelling each other out OK.  But from your
comment mentioned above, the one down the bottom of the page should be a
comment, so we shouldn't see the text.

Bug 91045 covers why view-source doesn't parse/highlight properly, but what
about the page itself?
Summary: incorrect parsing of HTML comments → incorrect parsing of HTML comments?
javascript:alert(document.compatMode) shows "BackCompat", which makes sense for
that DTD.  So we are parsing in "quirks" mode, not "standards" mode.  In
"quirks" mode we _do_ parse comments incorrectly, to be compatible with IE5/NS4.

Over to evangelism.  The page is a broken testcase.
Assignee: harishd → doronr
Component: Parser → US General
Ever confirmed: true
Product: Browser → Tech Evangelism
QA Contact: moied → zach
Version: other → unspecified

Comment 3

16 years ago for contact info.

Comment 4

15 years ago
My CS class's <a href="">home page</a> has
comments as follow:
&lt;!------------ table of contents -------------------&gt;
blah blah blah

"blah blah blah" should show up, but they do not - everything above and below
the comment lines do appear...

Comment 5

15 years ago
er, let's try that again - sorry about the extraneous HTML:

My CS class's home page ( has comments as

<!------------ table of contents ------------------->
blah blah blah

"blah blah blah" should show up, but they do not - everything above and below
the comment lines do appear...
> "blah blah blah" should show up

No it should not.  Here's the code from that page, with some spaces inserted for
clarity and the commented out stuff between '{' and '}'

<! --{}-- --{}-- --{}-- table of contents --{}-- --{}-- --{}-- --{}-- --{ ->
blah blah blah
<!--} --{}-- --{}-- --{}-- --{}-- --{}-- --{}-- --{}-- --{}-- --{}-- --{}-->

Note that the "blah blah blah" is commented out.

Comment 7

15 years ago
Peter, for a more detailed explanation, see Boris's comments at

The page is being rendered in strict mode, so strict comment parsing is being used.

Comment 8

15 years ago
now their making fun of us ... check the bottom of the page
maybe somebody should point them to validator ?
Michael, the comment is what this bug is filed on!  Did you even read comment 0?

That said, the page pretty much validates.  They even have a correct doctype. 
It's just that it's a doctype (HTML 4.0 Transitional) that we have chosen to
render in quirks mode.

I'm very tempted to mark this bug as invalid, because I don't think evangelizing
people to switch their page to strict mode is reasonable...

Comment 10

15 years ago
Another, this time high-profile, incorrect page where this shows up is here:

This is the document database search page for the Finnish parliament.

The entire search form is accidentally commented out.

Comment 11

15 years ago
i guess they goofed? eh?
Summary: incorrect parsing of HTML comments? → - incorrect parsing of HTML comments?

Comment 12

15 years ago
tech evang june 2003 reorg
Assignee: doron → english-us
QA Contact: zach → english-us
The 1.5 Browser parses the following code incorrectly:

                   <OL TYPE="1">
<!- *********** Insert list items of the form: "<LI><B> +++ Date +++ </B> +++
Item Text +++ </LI><P></P>" **********  ->
                        <LI><B>Dec. 5</B> - Community Christmas Parade, Builders
Club needs adult volunteers to help build the Kiwanis and Sponsored            
                                    Youth Float. Contact Stacy D. if you can
help. </LI><P></P>
                       <!- ******************************* End of list items
******************************* ->

It treats the "<LI>" inside the comment as part of the comment, but from the <B>
on, it treats the remainder of the comment as uncommented text. Just do a "View
source" to see how the browser sees this.

Comment 14

12 years ago
*** Bug 315121 has been marked as a duplicate of this bug. ***

Comment 15

7 years ago
The "Did you know that your Browser is buggy" sentence is still there.
Internal Server Error
Assignee: english-us → nobody
Last Resolved: 3 years ago
Component: English US → Desktop
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.