Closed Bug 287780 Opened 20 years ago Closed 20 years ago

Closing external JS tag with /> kills subsequent internal scripts

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: public, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

If you import an external script file and close it with the XHTML notation, like
this:

<script type="text/javascript" src="shazbot.js" />

And then you add another script, this one internal, like this:

<script type="text/javascript">
function ningy(){ var filligreep = null; }
</script>

. . . then the second script will not work (ie, in this example, calling ningy()
will generate a "function not defined" error message).

For an excruciatingly detailed writeup, with five different examples and a
suggested workaround for page designers, visit:

http://www.atuan.com/Problems/Prob2FunctionUndefined.html

Reproducible: Always

Steps to Reproduce:
1. Click link 1.  Ding!
2. Click link 2.  Error!
Will, 

First, the issue you bring up isn't really a Javacript engine issue. Bugs
against the JavaScript engine should be about the implementation of the language
itself which is independent of how it used in web pages. 

Second, you have fallen into the common error of attempting to use xml syntax in
an html document. See http://www.w3.org/TR/xhtml1/#guidelines for guidelines on
how to code xhtml served as text/html properly. I also refer you to
http://www.hixie.ch/advocacy/xhtml for why xhtml as html is considered harmful. 

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.