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

[whatwg] HTML 5 Script Tag

From: Cready, James <jcready@rtcrm.com>
Date: Thu, 06 Aug 2009 16:36:02 -0400
Message-ID: <C6A0B6F2.468F%jcready@rtcrm.com>
Is there any good reason why a <script> tag with the src attribute specified
can?t be self-closing?

I understand the need for a <script> tag to have an open and close tag when
you?re executing javascript inline:

<script type="text/javascript">
    alert("Huzzah! I got executed just like you though I would.");

However ?best practices? suggest keeping all your scripts external unless
you absolutely need to use inline scripting. So it seems odd to have an open
and close tag when you?re including an external JS file since it won?t
execute anything inside the tags anyway:

<script src="js/behaviour.js" type="text/javascript">
    alert("Boo! I won?t get executed just because the src attribute is
specified. Weak sauce.");

I feel like, if you?re including an external JS file, the syntax should look
more like the <link> tag used to include CSS files or even the <img> tag
with it?s src attribute. Both are self-closing and for good reason. Is there
any possibility of including this syntax in the HTML 5 spec or is there some
reason this can?t be done?

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

James W Cready ? Associate Web Developer
jcready at rtcrm.com ? office: (202) 339-6265

rtc relationship marketing ? www.rtcrm.com
1055 thomas jefferson st. nw, suite 200, washington, dc 20007

a wunderman network agency
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090806/00cc9a77/attachment.htm>
Received on Thursday, 6 August 2009 13:36:02 UTC

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