Closed Bug 375803 Opened 18 years ago Closed 18 years ago

Comments make parts of page to be commented out and not rendered

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 214476

People

(Reporter: mariusads, Unassigned)

Details

Attachments

(5 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 When comments are written in a certain form, parts of the page after the comment are considered commented, as if the comment tag did not end. The comments are according to rules not valid because they contain the - character inside however the behaviour is very strange in this example. Reproducible: Always Steps to Reproduce: 1. Open test page 2. View source code under comment containing "basic information" text. 3. add one - to the "-----" before basic information (final count of - to be 6), save page and reload 4. View source code again and check page layout in browser 5. Comment below containing "away information" is no longer considered comment 6. Remove added "-" character and view source again/view in browser. Actual Results: Certain parts of the page are not displayed and considered comments. Those parts are rendered correctly in other browsers. Expected Results: Firefox should have better handling of these comments even though rules say "-" are not allowed inside comments. The code should not have been considered comment and the comment line containing "away information" should be considered comment. When there is a series of five minus signs in the comment containing "basic information" text, all the code below it up to the "away information" comment is considered comment. Removing minus signs to that series of five minus signs doesn't do anything. Adding one minus sign to the 5 minus signs uncomments the code but also the comment containing "away information" text is no longer considered comment. Adding one minus sign to the 5 minus signs in the "contract information" comment will make Firefox comment out all code between the "basic information" and "contract information" comments, "away information" comment is again considered valid code. Removing one minus sign from the 6 minus signs series in the "away information" comment causes all code to appear but "basic information" comment is considered valid code, not a comment. There is also another problem not related to comments thing here, maybe it's another bug or a problem in my code. With the page loaded, click on Holiday Rights Information, then click on Access Rights Information. All panels are moved downwards and there is a space created under the menu. Clicking once on the Employee Information text causes the browser to remove that space but the panel is not minimized as it should. Clicking again minimizes it. It may be a bug in my code but I'm not sure yet. Without the bad comments, page validates on w3.org validator.
Page that illustrates the strange behaviour
comment with "basic information" text in it causes sections to be commented out
Adding one minus sign to "basic information" comment shows sections but also displays comment
Duplicate of Core bug 214476?
Yup. It's not that "the rules" say - isn't allowed in comments, it's that comments are not what people casually think they are - they don't start with <!--, or end with -->, they start and end with any --.
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
Guys (and maybe girls), I understand your point of view, I'd just like to make an observation. In the document listed here : http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4 and referenced by bug 214476 it says: A common error is to include a string of hyphens ("---") within a comment. Authors should avoid putting two or more adjacent hyphens inside comments. It says SHOULD, not MUST which, by the way I know RFCs are made, it probably doesn't mean I am not allowed to enter more than two "-" signs in a row. As the end comment separator is always "-->" why would Firefox or any browser end the comment after the first two -- signs it finds ? Also, if this was the case here, as I have the following comment in the page <!-- ------ basic information --[..] in any way you say it, it's still wrong. If <!-- marks the start and two minus signs mark the end of the comment then I should see "---- basic information --[..]" and the rest of the text code on the screen, the code in the page should not be interpreted as commented out. Even if two minus signs mark the start and two mark the end, there are 6 minus signs before basic, which would start and end a second comment, making "basic information" valid code on the page. Please note again the fact that simply by adding or removing a minus sign from that series of 6 minus signs before "basic information", that large chunk of html code is treated differently which to me clearly means a tag parsing error in Firefox. Bug 214476 is not like this, it mentions only the case when user enters the exact "--" text inside a comment, which really is the end tag for a comment. "---" or "------" or any length of "-" signs different than 2 is not end tag for comment. I've read again the comments in the original bug and noticed another thing: the page is rendered fine and all comments are closed properly if I remove the DOCTYPE declaration at the start of the page (which moves Firefox from Standard Compliance mode render to Quirks mode render).
SHOULD and MUST have special meaning in IETF RFCs that specifically say that they are using them with the RFC 2119 meaning; that does not include random non-IETF specs which do not say that they are, nor does it include lowercase "should" even in IETF RFCs that do use 2119 meanings for SHOULD. And the precise meaning of SHOULD is "if you don't follow our advice here, it is up to you to know the risks, and to accept the blame if something doesn't interpret your output the way you intended it to be interpreted." That's the reason it's in all caps, and always used with a reference to the definition of how it's being used: it doesn't mean "we would be very happy with you if you did X" as it does in common language, it means "if you choose to ignore this, on your head be it." MUST means "you have to do it this way even if nothing breaks if you don't", SHOULD means "if you don't do it this way, when something breaks everyone else will wait for you to fix your mistake, not work around it." <! marks the start of SGML markup, and within SGML markup, every pair of hyphens starts a comment if one is not open, or closes one if it is. ------ is the start of one comment, the end of that comment, and the start of another comment. ----- is the start of one comment, the end of that comment, and a single hyphen which is not in a comment. But just because it's not in a comment doesn't make it text in the document - you still started SGML markup with that <!, and haven't yet ended it with a --> which is not inside a comment. That makes "basic information" SGML markup which we don't recognize or understand, not document text.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: