Re: Empty <script> bug (XHTML documents)

On Mon, 3 Nov 2003, Beton, Richard wrote:

> I have noticed that XHTML documents are passed as valid even when they
> contain empty <script> elements. For example,
>
>   <script src="js/whatever.js"/>

Why would that not be valid? By XML rules, it is equivalent to
<script src="js/whatever.js"></script>

"Empty-element tags may be used for any element which has no content,
whether or not it is declared using the keyword EMPTY. For
interoperability, the empty-element tag should be used, and should only be
used, for elements which are declared EMPTY."
  http://www.w3.org/TR/REC-xml#sec-starttags

(The empty-element tag adhockery is a constant source of confusion; for a
treatise, see http://www.cs.tut.fi/~jkorpela/html/empty.html )

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Monday, 3 November 2003 12:14:51 UTC