Closed Bug 186537 Opened 22 years ago Closed 22 years ago

Javascript write() output invalidate comment structure

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 165323

People

(Reporter: croo, Assigned: harishd)

References

()

Details

(Keywords: testcase)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3a) Gecko/20021212 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3a) Gecko/20021212 This code is derive from one of internet-counters, and was validate from W3C. This simple code should made aumatic 'comment' structure. <script type="text/javascript"><!-- document.write('<'+'!-- ') //--></script> <script type="text/javascript"><!-- if(2>1)document.write('--'+'>') //--></script> So it's output should be nill. But by an unknown reason, output of firm write() made a second script commented and (wich is more important) sign of > become the end of this comment. So if I change 2>1 to 1<2 in if() statement, result would be different. Reproducible: Always Steps to Reproduce: 1.Run http://www.stabes.nm.ru/bug.htm 2. 3. Actual Results: In first block there is wrotten: 1)document.write('--'+'>') //--> Expected Results: This text is a part of <script> code and shpould not be showned Opera and IE both write() result is O'k. Same as Mozilla result could be obtained by Galeon on Linux. This bug could be easily workaround by web-designer (not use > symbols in scripts), but this is not wery good.
Keywords: testcase
Perhaps dupe of Bug 165323
No, I think it is not same to 165323 -- there is no problem with writing "comment" field (as you see, this code use '<'+'!--' to workaround same problem in old browsers.
Confirming, and over to the HTML parser component.
Assignee: jst → harishd
Status: UNCONFIRMED → NEW
Component: DOM Level 0 → Parser
Ever confirmed: true
QA Contact: desale → moied
Summary: Javascrtipt write() output invalidate comment structure → Javascript write() output invalidate comment structure
O'k. I study http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4 a lot and now know what is happened. Le me show it first. Let us wrote a following html-code: <!-- <script type="text/javascript"><!-- if(2>1)document.write('--'+'>') //--></script> It's correct code but with a some mistake in comment structure. We see that <!-- open the comment, and when we search where is finish. We know, that between -- and > could be be white space, but as we could note, also if between -- and > is some letters, it counted as finish too. So I think this is problem N1, --xxx> also counted as comment finish. Secondary problem in code. <!-- <script type="text/javascript"><!-- if(2<1)document.write('--'+'>') //--></script> We see, that it is finished wihout any text, so '>' symbol is not finishing. Why? because secondary '--' invalidate first '--' even between them is some letters. So I see that real trouble is in HTML comments parsing. Could somebody tell me, is there bug about --xxx> closing comment? If yes, this bug should be duplicate.
*** This bug has been marked as a duplicate of 186768 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Hm. Look that this behaviour of comment structure is desired, so we realy have problem, described by me first.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Frank is right. The 2>1 case has an unterminated comment, triggering bug 165323 *** This bug has been marked as a duplicate of 165323 ***
Status: REOPENED → RESOLVED
Closed: 22 years ago22 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.