Closed Bug 294796 Opened 19 years ago Closed 19 years ago

HTML comment shown when browsing a page

Categories

(Firefox :: General, defect)

defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 214476

People

(Reporter: gonzalo, Unassigned)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050506 Firefox/1.0 (Ubuntu package 1.0.2)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050506 Firefox/1.0 (Ubuntu package 1.0.2)

Not much to say here. Just try it and see for yourself.

Reproducible: Always

Steps to Reproduce:
1. Just go to the URL above or put the following in a file and browse it:
=begin=========================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>file-Upload test</title>
</head>
<body>
<!-------------------------------------------------------------------------
-->
<h1>Hola</h1>

</body>
</html>
=end============================
Actual Results:  
A whole bunch of dashes ended in a '>' are displayed before a 'Hola'.

Expected Results:  
Just the 'Hola'.

Tested with firefox 1.0.2 on linux and 1.0.3 on windows.

Original bug filed on mono ASP.NET in
http://bugzilla.ximian.com/show_bug.cgi?id=74988
Forgot to mention that when viewing the source in firefox the starting '<!' is
not in the source, but it came through the network.
Here is what I get when I save the page and open it in a text editor. It
explains why Firefox is doing what it is. Even if it is wrong.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1"><title>file-Upload test</title></head>

<body>
<!---->-------------------------------------------------------------------------
--&gt;
<h1>Hola</h1>

</body></html>
See bug 214476 comment 4

*** This bug has been marked as a duplicate of 214476 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Reporter, You very definitely need to read the last part of  
bug 214476 comment 4 which explains that SGML parsing of comments is only 
performed when in strict mode (with a DOCTYPE), to wit, only on behalf of 
authors who  understand SGML at least a bit, or are prepared to learn about
standards.

The report to the Ximian folk has been resolved as not Ximian, and they need
to know that it is not Firefox either.

In that report it is decribed how it is possible to comment out SSI directives
and that directives (evidently) do not work inside comments. This is probably 
by design.

I don't understand the reference to aspx, and this might be something to
do with Ximian.

Whatever is parsing the file that the Ximian bug refers to will almost
certainly need a quirks mode, as many HTML authors do not understand
SGML comments (and if a quirks mode is available will not need to); 
and if this has not been provided then it would seem
to be a reasonable Enhancement Request for Ximian (or the specific software
concerned).

I don't understand: "the starting '<!' is not in the source, but it came 
through the network."

Whilst it would seem to indicate that the problem is well upstream from 
Firefox, you want want to clear that up. Do you think that Firefox is
mis-parsing comments in either Strict or Quirks mode?

Comment 2 : Firefox is not wrong, it does 'what it does' because of the 
DOCTYPE. I enclose a testcase with Quirks mode comment parsing.
If the reporter's DOCTYPE is used, then the comment is parsed formally 
correctly, and the (unwanted) CDATA is rendered. You can also see this in
a syntax highlighting editor such as vim (parsing not required); but not 
Firefox's view source (this is arguably a defect in Firefox as View Source
might be expected reveal errors), which uses the same parse as the render.

In summary: most HTML authors have never needed to understand SGML parsing,
and tools should support this in default modes.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: