Closed
Bug 589433
Opened 15 years ago
Closed 15 years ago
buggy HTML comment tag when HTML4 strict
Categories
(Core :: DOM: HTML Parser, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 214476
People
(Reporter: yoann, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.2.8) Gecko/20100723 Ubuntu/10.04 (lucid) Firefox/3.6.8
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.2.8) Gecko/20100723 Ubuntu/10.04 (lucid) Firefox/3.6.8
In an HTML4 strict page, the HTML comment Tag behaves innapropriatelly.
This tag <!-- (lower than, exlamation mark, minus, minus) marks the beginning of a comment
but, if my comment contains -- (twice minus) in the middle of it,
then, the actual end of comment tag (twice minus, greater than) will be skipped -->
And all the text and HTML code following the supposed end of comment will be included into this comment.
The comment will remains opened till the end of a next comment, or till the next comment contains the > (greater than) symbol.
Notes : I also noticed there is a difference if the code given as example (see steps to reproduce or the URL) is displayed from an .html page or from a .php page.
When from a .php page, the behavior is the same as described here.
When from a .html page, the first comment ends at the end of the seconds comment and not at the first > (greater than) symbol.
Reproducible: Always
Steps to Reproduce:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head></head>
<body>
<pre><!-- Here starts my comment.
Here, I write c-- because I like it (lets image it's some javascript code).
My comment should stop here : -->
</pre>
Here i'm supposed to be out of the comment.
But my Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.2.8) Gecko/20100723 Ubuntu/10.04 (lucid) Firefox/3.6.8
still thinks i'm inside the comment ...
<pre> And here is supposed to start a new comment,
which will be ignored since the browser failed to close the previous one.
Now, if all of a sudden I write here this > symbol, then, that's where ends the comment ...
... instead of here :
--></pre>
If I remove the <code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"></code>, then, the bug vanishes.
</body></html>
Actual Results:
When from a .php page :
{#### QUOTE #### QUOTE #### QUOTE #### QUOTE #### QUOTE ####
symbol, then, that's where ends the comment ...
... instead of here :
-->
If I remove the <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">, then, the bug vanishes.
#### QUOTE #### QUOTE #### QUOTE #### QUOTE #### QUOTE ####}
And when from an .html page :
{#### QUOTE #### QUOTE #### QUOTE #### QUOTE #### QUOTE ####
If I remove the <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">, then, the bug vanishes.
#### QUOTE #### QUOTE #### QUOTE #### QUOTE #### QUOTE ####}
Expected Results:
{#### QUOTE #### QUOTE #### QUOTE #### QUOTE #### QUOTE ####
Here i'm supposed to be out of the comment. But my Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.2.8) Gecko/20100723 Ubuntu/10.04 (lucid) Firefox/3.6.8 still thinks i'm inside the comment ...
If I remove the <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">, then, the bug vanishes.
#### QUOTE #### QUOTE #### QUOTE #### QUOTE #### QUOTE ####}
I reported the bug on launchpad too :
https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/621220
The HTML source code provided as example was altered. HERE IS THE GOOD ONE :
https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/621220/+attachment/1507958/+files/test.html
----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head></head>
<body>
<pre><!-- Here starts my comment.
Here, I write c-- because I like it (lets image it's some javascript code).
My comment should stop here : -->
</pre>
Here i'm supposed to be out of the comment.
But my Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.2.8) Gecko/20100723 Ubuntu/10.04 (lucid) Firefox/3.6.8
still thinks i'm inside the comment ...
<pre><-- And here is supposed to start a new comment,
which will be ignored since the browser failed to close the previous one.
Now, if all of a sudden I write here this > symbol, then, that's where ends the comment ...
... instead of here :
--></pre>
If I remove the <code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"></code>, then, the bug vanishes.
</body></html>
Note : with this correct version of the HTML code example showing the bug that I've just posted, the behavior is the same whatever it is displayed from a .html or a .php page ... so you can ignore this detail.
BUT THE BUG IS STILL PRESENT AND REPLICABLE.
Sorry for the mess. That was my first bug report to bugzilla ...
Comment 3•15 years ago
|
||
In the future, please search before posting.
In HTML4 comments are really denoted with "--". This has confused people for ages. This has been changed for Firefox 4+ with the new HTML5 parser.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
@Dave Garrett saying : "In the future, please search before posting."
And am I also supposed to appologize for the fact that I failed to find this bug is a dupplicate just because english is not my first language ?
Comment 5•15 years ago
|
||
You don't have to apologize for anything. It was just your first bug filed and you didn't find the existing ones. Please don't misinterpret me as being annoyed at you or anything.
Duplicates are filed all the time, we just want to try to avoid them. I only suggested that you search before posting, as a search for all open and closed bugs containing "html comment --" in the title finds quite a few of these bug reports. I'm sorry if any language issues hindered your search, though, anyone can make this mistake. We all file bugs that turn out to be duplicates, from time to time. Don't worry about it. ;)
You need to log in
before you can comment on or make changes to this bug.
Description
•