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

Re: The script language attribute

From: Philip Taylor <philip@zaynar.demon.co.uk>
Date: Sat, 08 Sep 2007 14:43:32 +0100
Message-ID: <46E2A704.7@zaynar.demon.co.uk>
To: Anne van Kesteren <annevk@opera.com>
CC: Mihai Sucan <mihai.sucan@gmail.com>, public-html <public-html@w3.org>

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:

IE6/7: "JavaScript1.(1|2|3)", "JScript", "LiveScript", "EcmaScript", 
"JavaScript".

Firefox 2: "JavaScript1.(0|1|2|3|4|5|6|7)", "LiveScript, "Mocha", 
"JavaScript".

Firefox 3: As in FF2, but with "JavaScript1.8" too.

Opera 9.2/9.5: sort of "JavaScriptN.M" where N.M <= 1.5 except more 
complex and weird (it ignores any hyphens before the number, it accepts 
1.01 but not 1.11, etc), and "JScript", "LiveScript", "EcmaScript", 
"JavaScript".

Safari 3: "JavaScript1.(1|2|3|4|5|6|7)", "JScript", "LiveScript", 
"EcmaScript", "JavaScript".

(Those lists for Firefox and Safari should be comprehensive, since they 
come from the source code; IE and Opera might accept other values too.)

All those values are handled identically (as far as I can see), and all 
other values result in the script not executing.


So, the only ones in common between all browsers are "JavaScript", 
"JavaScript1.1", "JavaScript1.2", "JavaScript1.3". Hopefully that 
corresponds with the values that people are using in practice, but it 
may be good to test that.

-- 
Philip Taylor
philip@zaynar.demon.co.uk
Received on Saturday, 8 September 2007 13:43:44 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:49 UTC