Self-closing Script Tags

A cautionary note: using self-closing <script> tags generally will cause your browser to ignore the tag altogether. E.g., this doesn’t work:

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

It took me a bit to figure out what was going on here, because it’s perfectly valid XML. However, since most web servers are going to mark webpages as HTML rather than XHTML+XML, it gets parsed as HTML, which doesn’t allow you to self-close tags that don’t have the EMPTY content model (like <br> or <hr>).