In XML <foo></foo>
and <foo/>
mean exactly the same thing. So in an XHTML document (if it is interpreted as XML), there is no difference between them.
In SGML, they do not.
HTML was, historically, designed as an SGML application (and predates XML). Browsers have implemented their parsers with this in mind (although they are not complete SGML parsers and some valid syntax is incorrectly handled).
When you serve a document to a browser with a text/html Content-Type, it interprets it as HTML.
Thus <script/>
is treated as a start tag for an element where the end tag is required.
When writing HTML compatible XHTML (i.e. XHTML that is served as text/html) the guidelines recommend that elements which are defined as EMPTY (and thus the end tag is forbidden) be expressed as <foo/>
and all other elements be expressed as <foo></foo>
.
Since the <script>
element can have content (an inline script), the end tag is not forbidden, so the explicit end tag is needed.