[whatwg] HTML 5 Script Tag

Aryeh Gregor Simetrical+w3c at gmail.com
Thu Aug 6 13:52:51 PDT 2009


On Thu, Aug 6, 2009 at 4:36 PM, Cready, James<jcready at rtcrm.com> wrote:
> Is there any good reason why a <script> tag with the src attribute specified
> can’t be self-closing?

Because the HTML serialization should be parseable by legacy
user-agents.  <script src="foo" /> will be treated the same as <script
src="foo"> by all existing UAs in text/html, and all subsequent
content on the page will become part of the <script> tag, possibly
causing the whole page to vanish (maybe less than the whole page if
there's a </script> somewhere).  The spec doesn't permit behavior in
text/html that's incompatible with existing UAs without good reason.

You can, of course, use the XHTML serialization, in which any empty
element can be self-closing.



More information about the whatwg mailing list