W3C home > Mailing lists > Public > public-html@w3.org > September 2007

Re: The script language attribute

From: Mihai Sucan <mihai.sucan@gmail.com>
Date: Sat, 08 Sep 2007 18:41:24 +0300
To: "Philip Taylor" <philip@zaynar.demon.co.uk>, "Anne van Kesteren" <annevk@opera.com>
Cc: public-html <public-html@w3.org>
Message-ID: <op.tycdvazemcpsjgr0b0dp@athlon>

Le Sat, 08 Sep 2007 16:43:32 +0300, Philip Taylor  
<philip@zaynar.demon.co.uk> a écrit:

> Anne van Kesteren wrote:
>>  On Sat, 08 Sep 2007 14:09:20 +0200, Mihai Sucan  
>> <mihai.sucan@gmail.com> wrote:
>>> 2. The algorithm for running a script says that the value of the  
>>> "language" attribute is prefixed with "text/", and that the resulting  
>>> string is the MIME type of the given script. However, I believe that's  
>>> not a complete interpretation of the "language" attribute. It's known  
>>> there are documents which use values such as "JavaScript",  
>>> "Javascript", "JavaScript 1.2", "JScript", "javascript1.5", etc.
>>> The value is generally a mess.
>>  It depends on what user agents do with the value in the end. Does  
>> "JavaScript 1.2" for instance trigger the slight subtleties for the 1.2  
>> codepath?
> It looks like there are no differences. See e.g.  
> https://bugzilla.mozilla.org/show_bug.cgi?id=255895 ("JS1.2 must die")  
> where language detection was removed from Firefox 1.5+, and  
> http://lxr.mozilla.org/mozilla/source/content/base/src/nsScriptLoader.cpp#381  
> saying "IE, Opera, etc. do not respect language version, so neither  
> should we at this late date in the browser wars saga."
> https://bugzilla.mozilla.org/attachment.cgi?id=167555 shows that  
> language=JavaScript1.2 and language=JavaScript are treated the same (at  
> least in semi-recent versions of IE/Safari/Opera/Firefox).
> The language attribute still matters in deciding whether something  
> should be executed as JavaScript. Extending the above demonstration in  
> http://canvex.lazyilluminati.com/misc/jsversions.html shows the  
> following values are understood:
> [...]

What I am saying is that the current algorithm for running scripts simply  
assumes that the "language" attribute value is used as part in script MIME  
type: 'text/' + language. For JavaScript, this is known to not always be  
the case. More precisely, there's no strict equivalence between the type  
attribute and the language attribute. The spec allows for an equivalence  
between the language and type attributes like this: type=text/javascript  
or language=javascript - all the same. Yet, in current UAs that's not  
true: type=text/mocha won't do the same as language=mocha. One can check  
this by looking into the source code of Gecko (at the link provided by  

The spec should point out that JS is a special case and that it can be  
detected based on a known list of possible values. As you said, the  
attribute matters in deciding if the code is to be executed as JavaScript,  
or not. Yet the current algorithm in the spec fails if someone uses  
<script language="JavaScript 1.2"|Mocha|other-possible-values>.

IMHO, the spec doesn't go into enough details about this attribute.

Received on Saturday, 8 September 2007 15:41:41 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:26 UTC