Closed Bug 22748 Opened 25 years ago Closed 25 years ago

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

Categories

(Core :: Layout, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED DUPLICATE of bug 22485

People

(Reporter: evan, Assigned: rickg)

Details

Attachments

(1 file)

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.
Attached file Minimal bug example.
Assignee: troy → vidur
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>
 >
Assignee: vidur → rickg
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).
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → DUPLICATE
*** This bug has been marked as a duplicate of 22485 ***
Status: RESOLVED → VERIFIED
Marking as verified duplicate of 22485.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: