[whatwg] E4X and attribute values

On Tue, 16 Jan 2007, Henri Sivonen wrote:
>
> Is E4X allowed in event handler attribute values and in javascript: 
> URIs? If yes, how can a UA know whether the E4X parse mode should be 
> used?
> 
> (It seems to me that it would make sense not to allow E4X in those cases 
> and require the script snippets to call into E4X scripts included using 
> the <script> element. But I don't really know what Firefox does here.)

On Tue, 16 Jan 2007, Kornel Lesinski wrote:
> 
> This can be explictly stated using Content-Script-Type HTTP header/meta and
> Mozilla's MIME type parameter:
> <meta http-equiv="Content-Script-Type" content="text/javascript; e4x=1" />
> 
> http://developer.mozilla.org/en/docs/New_in_JavaScript_1.6
> http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.2.1
> 
> However since the e4x type parameter seems to be only affecting parsing 
> of comments and CDATA inside <script>, it's irrelevant for attributes, 
> so I think it shouldn't be required and E4X should work in 
> attributes/bookmarklets by default.

There is currently no mechanism in HTML5 to control the langueg of an 
event listener. I'm not really sure how to provide this extensibility -- 
the HTML4 mechanism is very coarse (it just controls the language of all 
event handler attributes), but I can't see any efficient way to introduce 
a more fine-grained mechanism.

My recommendation would be to ensure that extensions to JavaScript, and 
new languages in general, be written to either be backwards-compatible, or 
be written with a signature at the front. This would allow authors to 
upgrade scripts independently of referencing mechanisms (e.g. allowing 
sites to upgrade to newer language features without changing the <script> 
block that refers to them).

In any case, as Kornel says, it seems like this is a non-issue for the 
original problem raised, namely of E4X in attributes.

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

Received on Thursday, 15 January 2009 00:11:33 UTC