Persona is no longer an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 197226 - parser or JS issue caused by 1 self closing script tag followed by an other script tag
: parser or JS issue caused by 1 self closing script tag followed by an other s...
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: x86 Windows 2000
: -- normal (vote)
: ---
Assigned To: rogerl (gone)
: Phil Schwartau
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2003-03-13 11:41 PST by L Rutker
Modified: 2003-03-13 13:53 PST (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description L Rutker 2003-03-13 11:41:15 PST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2) Gecko/20021126
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2) Gecko/20021126

The html below validated against the w3 validator.
the self closing first script tag causes the second script to not work.
It is either a parsing issue or a javascript issue.
<script language="JavaScript" type="text/javascript" 
src="/path/path/someScript.js" />
<script language="JavaScript" type="text/javascript"

will get the page to work

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" xml:lang="en" lang="en">
	<title>International Wach</title>
	<link rel="stylesheet" href="/path/path/style.css" type="text/css" />
        <script language="JavaScript" type="text/javascript"
src="/path/path/someScript.js" />
        <script language="JavaScript" type="text/javascript">
            function alertMe(){
                alert("this is an alert");
		<form method="post" name="myForm" action="/someOtherPage.jsp">
			<input type="button" value="press" onclick="JavaScript:alertMe();" />

Reproducible: Always

Steps to Reproduce:
1. take html above and save it locally
2. load into browser and try to press button
3. when nothing happens change self closing first script tag
4. reload page and click button
5. watch alert show up as it should

Actual Results:  
changing self enclosing tag to ></script> fixed problem

Expected Results:  
proper parsing

xhtml that does not work above woks in IE 5.5 but NOT IE6 (regression bug?)
Comment 1 Boris Zbarsky [:bz] (still a bit busy) 2003-03-13 12:12:53 PST
If it works in IE, you're serving it as text/html.  <script /> is NOT a closed
tag in text/html content.

And looks like IE6 in fact _fixed_ a bug.
Comment 2 L Rutker 2003-03-13 13:31:06 PST
Does the same apply to the css tag or only the script tag? Are there any other
cases that are like the script tag?
Where can I find a reference that shows that the script tag can't be self closing?
Comment 3 Phil Schwartau 2003-03-13 13:37:49 PST
Marking Verified.

I don't know the answer to the questions above, but a good place
to try is the Mozilla DOM newsgroup or similar:


It's not JS Engine, since the engine has no concept of HTML tags.
Comment 4 Boris Zbarsky [:bz] (still a bit busy) 2003-03-13 13:38:40 PST
See appendix C of the XHTML specification.  It describes the rules an XHTML file
must follow to work as text/html.  One of them is that nonempty tags need an
explicit end tag.  This would include <script>, <style>, etc.
Comment 5 L Rutker 2003-03-13 13:44:57 PST
Would the proper way to use my frist script tag be:
<link rel="script" href="/path/path/someScript.js" type="text/javascript" />
as opposed to:
<script language="JavaScript" type="text/javascript"

Thanks for all the help
Comment 6 Boris Zbarsky [:bz] (still a bit busy) 2003-03-13 13:53:39 PST
Not if you expect it to work with any current browser.

Note You need to log in before you can comment on or make changes to this bug.