Closed Bug 271882 Opened 20 years ago Closed 20 years ago

script code is displayed if the script element is assigned a display:block style value

Categories

(Core :: Layout: Block and Inline, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

()

VERIFIED INVALID

People

(Reporter: simone, Unassigned)

Details

Attachments

(2 files, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

If I assigne to a script tag a display:block attribute (<script
style="display:block;">) the content of the script is first displayed on the
page, than it is executed

Reproducible: Always
Steps to Reproduce:
Look at the testcase for an example
Actual Results:  
Script code is displayed

Expected Results:  
Should just execute
Attached file Testcase (obsolete) —
I used this thing because I wanted the result of the script to be displayed as
block element.
If that's what you want, output something that's display:block.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
OK, but should not display the "code" of the script.
Should display just the results of the scripts.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Attached image Screenshot of what I see (obsolete) —
This what I see, the code is written on the page
Attached file More Complex script
In this example you see that (maybe in the other it was clear enough) the
source of the script is rendered on the page
Attachment #167124 - Attachment is obsolete: true
As I understand it, the text of a script only doesn't display because the script
has display:none. When you change it to display:block, the text shows up.

You could try doing document.write("<div>This text is written by a
script</div>"), or something equivalent.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → INVALID
The screenshot of the new page
Attachment #167133 - Attachment is obsolete: true
So, in response to comment #7, you are telling me that the the fact that a the
code of the script is displayed is just because it has as default display:none?
Anyway I'll suggest that a script tag cannot have the source displayed on the page
(In reply to comment #9)
> So, in response to comment #7, you are telling me that the the fact that a the
> code of the script is displayed is just because it has as default display:none?

That's my (albiet limited) understanding of it.

You should also note that when you document.write something, the result is _not_
a child of the script, so setting disply:block on the script doesn't affect the
thing being written anyway.
Verified invalid.  There's no reason we should prevent the script being
displayed if the page author wishes to display it.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: