W3C home > Mailing lists > Public > www-html@w3.org > November 2003

Re: <link> vs. <script> for external scripts

From: Lachlan Hunt <lhunt07@postoffice.csu.edu.au>
Date: Thu, 20 Nov 2003 18:31:38 +1100
Message-ID: <3FBC6DDA.6050401@postoffice.csu.edu.au>
To: ernestcline@mindspring.com
Cc: W3C HTML List <www-html@w3.org>

Hi All,

>Well since the attribute that specifies the scripting language of the
>script should be required, then if that attribute isn't there, it wouldn't
>be valid XHTML2, so it wouldn't be rendered, end of story.
(I'll use @language for these examples for simplicity, even though it 
may not be the actual name of the attribute)

Agreed, make @language a required attribute, and use the <script> 
element for internal scripts.  External scripts (without an internal 
substitute) should be included using a <link> element
    <link rel="Script" type="text/javascript" href="script"/>

  External scripts with an internal substitute would still be allowed 
using the following.
    <script language="text/javascript" type="text/vbscript" src="script">
        // Alternate Script
        <noscript>no script content</noscript>

  With only @type, that is not possible, since @type would apply to both 
internal and external scripts.

>>>It has some other advantages besides allowing generic embedding.
>>>Since type is not a required attribute in general, but needs to be
>>>for script (and for style as well) so using a separate attribute seems
>>>preferable, especially if type allows for multiple types to be indicated.
  Everthing above about <script> also applies to <style> because @type 
also applies to the internal content, rather than just an external 
resource.  It would be good if both <script> and <style> were given the 
same attribute for describing their internal content, and leave external 
scripts and styles, mostly, for the <link/> element.  Style would then 
<style language="text/css">
/* stylesheet */

><script> added to <head>, MCM: (PCDATA|script)* ,
><blockscript> added to Block content, MCM: (PCDATA|blockscript|blocknoscript)* ,
><blocknoscript> added to Block content, MCM: (PCDATA | Flow)* ,
><inlinescript> added to Inline content, MCM: (PCDATA|inlinescript|inlinenoscript)*
><inlinenoscript> added to Inline content, MCM: (PCDATA|Inline)* .
I'd keep <noscript>, so that the script/noscript elements come in pairs:
* <script>/<noscript>, <blockscript>/<blocknoscript> and 

  This would certainly solve many of the problems, however, with the use 
of the DOM and XMLEvents, and the fact that document.write(), or 
similar, shouldn't be used any more, is there any need to have scripts 
outside of the head element and within the body?

Received on Thursday, 20 November 2003 02:32:36 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:06:06 UTC