Re: Determining Script Type

On Wed, 14 May 2008, Jim Jewett wrote:
> On 5/14/08, Ian Hickson <ian@hixie.ch> wrote:
> > On Tue, 7 Aug 2007, Jim Jewett wrote:
> >  >
> >  > In http://lists.w3.org/Archives/Public/public-html/2007Aug/0354.html,
> >  > Smylers said that the overall default should be "text/javascript", and
> >  > pointed out that the algorithm was for parsing, not authors.  This
> >  > allows further simplification, and I suggest replacing step 1 of
> >  > http://www.whatwg.org/specs/web-apps/current-work/#running0 with the
> >  > following
> >  >
> >  > """
> >  > The script's type is determined by the value of the script element's
> >  > type attribute.
> >  >
> >  > A type attribute which is either missing or equal to the empty string
> >  > indicate the default value of "text/javascript", for ECMAScript.
> >  > Otherwise, the attribute's value (which SHOULD be a valid MIME type)
> >  > is used directly.
> >  >
> >  > For backwards compatibility, if the type attribute is missing (not
> >  > just empty, but missing), user agents SHOULD also check the language
> >  > attribute.  If language is present (and not equal to the empty
> >  > string), then the script's type is treated as "text/" + the value of
> >  > the language attribute.
> >  > """
> >
> > I don't understand what problem this is solving.
> 
> The current wording is too complex, because of ambigously nested ifs and 
> otherwises.

Ok, but the proposed text above is no better. :-) It inappropriately uses 
SHOULD, it has authoring criteria as parentheticals of implementation 
criteria, it uses the voice of statements of fact to make definitions, and 
it contradicts itself (consider the case of <script language="x">).


> For example, (I believe) the first paragraph currently applies to
> 
>     ((type="" or (null type) and language="") or
>      ((null type) and (null language)))

That is correct.

> Depending on precedence within the first part of that, it may or may not include
> 
>     type="" and language="somethingelse"
>     type="" and (null language)

It includes both, yes.


> and it will either include or exclude both -- even though I *think*
> the answers should be different.

Why?


> If they are not included, then the third paragraph says there must be a 
> language attribute, so type="" must have been enough to trigger the 
> second paragraph, which again seems wrong for the 
> language="somethingelse" case.

Why?


I've tried to clarify the rules by splitting the paragraph into a list.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 5 August 2008 20:31:51 UTC