Closed Bug 284806 Opened 20 years ago Closed 20 years ago

Multiple SCRIPT tags ignored in XHTML when using <script/> but parsed properly when using <script></script>

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: Jeffrey.Rodriguez, Unassigned)

Details

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

My page is XHTML 1.0 Strict, given the following code inside the HEAD tag:

<script type="text/javascript" src="js/AnchorPosition.js"/>
<script type="text/javascript" src="js/PopupWindow.js"/>
<script type="text/javascript" src="js/ColorPicker.js"/>
<script type="text/javascript">
	//<![CDATA[
	alert("Hello World");
	//]]>
</script>

Only the FIRST script tag will be parsed and imported. Using the JavaScript
Debugger extension, only the first file, "AnchorPosition.js" is imported.

After changing the HTML to use long hand <script></script> instead of the
shorthand <script/>, the imports work as expected:

<script type="text/javascript" src="js/AnchorPosition.js"></script>
<script type="text/javascript" src="js/PopupWindow.js"></script>
<script type="text/javascript" src="js/ColorPicker.js"></script>
<script type="text/javascript">
	//<![CDATA[
	alert("Hello World");
	//]]>
</script>

I have not verified this is a problem using any other DTD.

Reproducible: Always

Steps to Reproduce:
1. Create an HTML document with the above 'broken' code
2. Load the page

Actual Results:  
Only the first <script> tag is properly imported.

Expected Results:  
Imported every <script> tag and processed the end alert("Hello World"); in the
end script tag.
What does the Page Info dialog say next to "Type:" when you load your XHTML page?
(View->Page Info)
It should work if you serve the page as "application/xhtml+xml" or "text/xml"
for example. Please reopen the bug if doesn't.

-> INVALID
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.