Why don't self-closing script tags work?
What is the reason browsers do not correctly recognize:
<script src="foobar.js" /> <!-- self-closing script tag -->
Only this is recognized:
<script src="foobar.js"></script>
Does this break the concept of XHTML support?
Note: This statement is correct at least for all IE (6-8 beta 2).
Solution:
XHTML 1 specification says:
Given an empty instance of an element whose content model is notEMPTY
(for example, an empty title or paragraph) do not use the minimized form (e.g. use<p> </p>
and not<p />
).
XHTML DTD specifies script tags as:
<!-- script statements, which may include CDATA sections -->
<!ELEMENT script (#PCDATA)>
http://stackoverflow.com/questions/69913/why-dont-self-closing-script-tags-work