Welcome to WebHeadStart.org

Web Technologies

Sponsored By

WebHeadStart.org is currently in beta.
Please pardon our appearance as we work to provide you with the most comprehensive reference on today's web technologies.

Interested in advertising on WebHeadStart? Become an advertising partner today!

[WWW-HTML Mailing List Archive Home] [Messages By Thread] [Messages By Date]

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>
    </script>

  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 
become:
<style language="text/css">
/* stylesheet */
</style>

><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 
<inlinescript>/<inlinenoscript>

  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?

CYA
...Lachy
Received on Thursday, 20 November 2003 02:32:36 GMT
Valid XHTML 1.0! Valid CSS! Site Map | Privacy Policy | Terms of Use | WebHeadStart.org © 2005 All Rights Reserved.