Re: The script language attribute

On Sat, 08 Sep 2007 14:09:20 +0200, Mihai Sucan <mihai.sucan@gmail.com>  
wrote:
> 1. The algorithm for running a script includes the usage of the  
> "language" attribute. This attribute is, however, left undefined. The  
> spec should "define" the attribute as a legacy attribute and  
> non-conformant.

Why should it be defined for the language if you want it be  
non-conformant? Doesn't the current specification do exactly what you  
want? It defines how user agents have to process it, but doesn't allow  
authors to use it.


> 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? (I'm unfortunately not aware of the differences, nor are they  
documented as far as I know, apart from the source code of browsers.)


> Two possible solutions:
>
> a) The spec defines some "algorithm" in regards to the language  
> attribute value. Something like:
>
> "The language attribute value must be lower cased. If the value starts  
> with 'jscript' or 'javascript', then set a new attribute value  
> 'javascript'. The script MIME type is the concatenation of the 'text/'  
> string with the language attribute value."

MIME types are already case-insensitive so it does not need to be  
lowercased. Also, the version number is significant as it triggers  
undocumented differences in code execution (unfortunately).


> That's probably still too simple, or maybe it works well enough, given  
> current implementations. I don't think current major UAs really "care"  
> what's the value of the language attribute.

If they didn't care it would not have to be defined.


> b) Mention that the language attribute value may require additional  
> parsing for legacy content, giving some examples "Javascript1.2",  
> "javascript 1.5", being all simply interpreted as "javascript".

That would not be compatible with legacy content as I understand it.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Saturday, 8 September 2007 12:18:57 UTC