W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2009

[whatwg] HTML 5 Script Tag

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Thu, 6 Aug 2009 16:52:51 -0400
Message-ID: <7c2a12e20908061352y4bd5ea39j76262d4463f460d@mail.gmail.com>
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.
Received on Thursday, 6 August 2009 13:52:51 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:15 UTC