Comment delimiters written in JavaScript don't hide content of comment

VERIFIED DUPLICATE of bug 22485

Status

()

P3
minor
VERIFIED DUPLICATE of bug 22485
19 years ago
19 years ago

People

(Reporter: evan, Assigned: rickg)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

19 years ago
I use comment delimiters written in inline JavaScript to hide alternative HTML
from script-enabled browsers.  In nightly build 1999122708 (at least) the
contents of the comment are rendered along with the output of the JavaScript.
I'll try to attach a minimal example.
(Reporter)

Comment 1

19 years ago
Created attachment 3862 [details]
Minimal bug example.

Updated

19 years ago
Assignee: troy → vidur

Comment 2

19 years ago
Somehow the text "Me worry" is getting into the content model which is why it is
displayed.

Here's the dump of the content model. Re-assigning to Vidur (my best guess).

 body@021DBED4 refcount=3<
   Text@021D8310 refcount=3<\n>
   script@021B9FDC language=JavaScript1.1 type=text/javascript refcount=2<
     Text@02148090 refcount=2<\n<!--\ndocument.write('<a href="javascript:0">Wh
t?</a>');\ndocument.write('<'+'!-'+'-\n');\n//-->\n>
   >
   a@021B8144 href=javascript:0 refcount=3<
     Text@021B8448 refcount=3<What?>
   >
   Text@02135330 refcount=3<\nMe worry?\n>
   script@02147F64 language=JavaScript1.1 type=text/javascript refcount=2<
     Text@021B7EE8 refcount=2<\n<!--\ndocument.write('-'+'-'+'>\n');\n//-->\n>
   >
   Comment@020C8768 refcount=2<!--\n-->
   Text@02149EF0 refcount=3<\nShouldn't see all that.\n>
 >

Updated

19 years ago
Assignee: vidur → rickg

Comment 3

19 years ago
The comment delimiters are correctly sent to the parser, but are thrown away
since they don't form a complete token. I believe Rick and I at one point
decided that we'd only accept complete tokens from document.writes (i.e. '<p' in
one document.write and '>' in a subsequent one would not work). Rick, I'm
wondering if comments should be a special case (since they can be multi-line).

Updated

19 years ago
Status: NEW → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → DUPLICATE

Comment 4

19 years ago
*** This bug has been marked as a duplicate of 22485 ***

Updated

19 years ago
Status: RESOLVED → VERIFIED

Comment 5

19 years ago
Marking as verified duplicate of 22485.
You need to log in before you can comment on or make changes to this bug.