[whatwg] HTML 5 Script Tag

On Thu, Aug 6, 2009 at 6:14 PM, Cready, James<jcready at rtcrm.com> wrote:
> You make a great point. But whether or not you use the XML/XHTML <syntax/>
> or the HTML 4 <syntax> doesn?t matter much. Since like I showed in my
> previous example: the instant you specify a src attribute on your opening
> <script> tag the browser will not execute anything inside the tags.
> Regardless of whether or not you even specified a value for it.
[snip]
> It seems like there should be some consistency between the two, either:
>
> A) Allow <link> to pull in all types of external files:
> ? ?CSS: <link rel="stylesheet" type="text/css" href="style.css" />
> ? ?JS : <link rel="javascript" type="text/javascipt" href="script.js" />
> or
> B) Allow ONLY <script> and <style> to pull in their external files:
> ? ?CSS: <style ?src="style.css" type="text/css"></style>
> ? ?JS : <script src="script.js" type="text/javascript"></script>

I (and others in this thread, and probably a lot of people on the web
as a whole) agree with you that it would be nice to have some
consistency there (I favor the <link> approach myself).  However, the
world is neither kind nor just, and one of HTML5's explicit guidelines
is to codify and standardize browser behavior in the wild.  We can
improve it when it's possible to do so in a backwards-compatible way,
but otherwise it's out.

<script src> is the way it is.  It's inconsistent, but that's how
generations of browsers have worked.  Trying to change it in the way
you suggest not only doesn't work in legacy browsers, it *actively
breaks* pages in those browsers.  It is simply *not* something that
would work unless you did a complete reboot with a purposefully
incompatible language - that was tried with XHTML2, and that spec is
dead now.  We're simply going to have to live with the warts of
earlier HTML

~TJ

Received on Thursday, 6 August 2009 16:46:45 UTC