Closed Bug 461587 Opened 16 years ago Closed 16 years ago

single-tag script elements do not work

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 327796

People

(Reporter: jlowery2663, Unassigned)

Details

User-Agent:       Opera/9.60 (Windows NT 5.1; U; en) Presto/2.1.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3

See code example in "additional information". 

Summary: <script type="text/javascript" src="foo.js"/> does not load the script file. <script type="text/javascript" src="foo.js"></script> does work. Does not matter if the doctype is set to XHTML strict.

Tested on another browser (Opera)... both examples work as expected.

Tried several different web servers, including Cherokee... same bug behavior.

Reproducible: Always

Steps to Reproduce:
1. create html and javascript files
2. launch a server (Cherokee or other)
3. Load html file
4. javascipt won't load when using <script ... /> syntax
Actual Results:  
javascipt file won't load when using <script ... /> syntax

Expected Results:  
file will load when using <script .../> or <script ...></script> syntax.

HTML:
<html>
<head>
<title>Debugging JavaScript using Firebug</title>
<script type="text/javascript" src="testhtml.js"/>
</head>
<body>
Debugging JavaScript using Firebug!
</body>
</html>

-----
JavaScript:
//implementing a stack, create a object
function Stack(){
	this.list = [];
}

Stack.prototype.push = function(value){
	this.list.push(value);
}

Stack.prototype.pop = function(){
	return this.list.pop();
}

Stack.prototype.size = function(){
	return this.list.length;
}

//create a custom toString function,
//event though Array object has its own
//we want to customize it a little bit
Stack.prototype.toString = function(){
	var temp = '[ ';
	for(var i = 0, length = this.list.length; i <= length; i++){
	  temp += this.list[i];
	  if(length - i != 1){
	  	temp += ', ';
	  }
	}
	temp += ' ]';
	return temp;
}

var stack = new Stack();
stack.push(1);
stack.push(2);
stack.push(3);
stack.push(4);
stack.push(5);
alert(stack.toString());
Oh, one more thing that might be relevant:

Fresh install with two add-ons loaded: Firebug 1.2.1 and YSlow. I had Firebug running when testing, but I don't think that is necessary to reproduce the bug.
Firebug doesn't matter, and doctype doesn't matter: the only thing that matters is whether you send the content-type application/xhtml+xml or text/html.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Okay, thanks for the clarification. I noted in the other bug that <script/> elements ARE getting parsed in on a coworker's machine who is running under Ubuntu. Same content, same browser, different environment.
You need to log in before you can comment on or make changes to this bug.