Re: Notes from Monday's meeting with TC39 folks

On Oct 8, 2009, at 10:07 AM, Brendan Eich wrote:

>
>> However that somewhat depends on whether IE keeps support behind a  
>> version switch because then sites might do the X-UA-Compatible  
>> trick and will still work in IE while not in Opera. That'd be  
>> annoying. (I'm not up in the details on which sites rely on this  
>> exactly unfortunately.)
>
> X-UA-Compatible considered harmful.
>
> Ok, back to striking a balance between providing better forms that  
> supplant bad older ones, rather than simply codifying (if not  
> building on) bad patterns.
>
> An idea at the meeting from Mark Miller, you won't be surprised by  
> it, is to make undetected document.all emulation not occur in ES5  
> strict mode ("use strict"). If you opt into ES5 strict mode in your  
> JS, you can't use document.all.
>
> I like this idea because I don't think new code should use  
> document.all, and old code that does use it is unlikely to be  
> retrofitted with "use strict". There is a risk in coupling to strict  
> mode in this way, turning off legacy misfeatures based on a  
> JavaScript pragma. But it beats adding another opt-in mechanism. And  
> it cleans up JS-level semantics: no magic context-sensitive host- 
> object document.all reification, or ES-spec-violating  
> ToBoolean(document.all) -> false.

At first glance, I'm not keen on the idea of making DOM API behavior  
depend on ES5 strict mode. Strict and non-strict code can mix freely,  
so to do the mode switching you have to know what kind of code is  
calling you - that seems yucky to implement and goes beyond the intent  
of strict mode that nearly all of its effects can happen at compile  
time. Also, affecting DOM APIs seems like major scope creep for strict  
mode. Right now, WebKit's DOM APIs have no idea what kind of code is  
calling them and I don't relish adding that functionality.

By contrast, document-level quirks mode vs. standards mode is a single  
global switch for the whole document. So it's much easier to implement  
the switching and verify that its correct. If we need to have  
switchable DOM API behavior, I'd rather base it on HTML standards vs.  
quirks rather than ES strict vs. non-strict.

Regards,
Maciej

Received on Thursday, 8 October 2009 17:44:08 UTC