I was going to title this, "New Ways I Discover I Am An Embarrassing DumbAss", but here goes. . .
I was working on something, and importing a JavaScript library. I was referencing it from a master page, in the head section, all was hearts and flowers. I decided I was going to add in a plugin and I added in a line for that script and some accompanying CSS. Hearts are broken, flowers dead.
I start to bang a soft spot in my head trying to figure this out. Its funny how something that should work just doesn't and your entire world view is shattered. I switched from IE7 to FireFox3. Still no love. No joy in Safari. On a lark I try Chrome, and it does work as expected. Now I am more confused, not less.
Going back to FF3, I look at the page via FireBug, and lo, there is the issue. Only one of my imported scripts is being imported. The problem? I didn't close the <script> element with a </script>, so I was doing this:
<script src="./js/jquery-1.2.3.js" type="text/javascript" />
instead of this:
<script src="./js/jquery-1.2.3.js" type="text/javascript"></script>
So why would that be an issue? If I had to guess, I'd say it has to do with the src attribute. From the W3C:
The script may be defined within the contents of the SCRIPT element or in an external file. If the src attribute is not set, user agents must interpret the contents of the element as the script. If the src has a URI value, user agents must ignore the element's contents and retrieve the script via the URI. Note that the charset attribute refers to the character encoding of the script designated by the src attribute; it does not concern the content of the SCRIPT element.
So because its designed to get something from its own contents or from an external URI, the closing tag would need to be there for those cases when there are contents. I guess its just easier to work with knowing it always has a closing tag instead of holding two different parsing rules based on the src attribute.