[whatwg] HTML 5 Script Tag
Cready, James
jcready at rtcrm.com
Thu Aug 6 13:36:02 PDT 2009
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.");
</script>
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.");
</script>
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>
More information about the whatwg
mailing list