On 12/20/2012 03:38 PM, Boris Zbarsky wrote:
> On 12/20/12 12:14 PM, Jeff Walden wrote:
>>  Setting it creates a shadowing property on window itself, using the exact 
>> value passed in.
>>
>>    // Current Gecko
>>    alert(typeof window.screenX); // number
>>    window.screenX = "123";
>>    alert(typeof window.screenX); // string, not number
> 
> Er...  no.  If you do that, you get number for the second alert, because you 
> did a qualified set.  That's the whole complication with these properties: 
> they behave differently for qualified and unqualified sets.

Oops, sorry, you're right.

I suppose I should mention for clarity that what I'm doing is trying to remove 
this difference.  There is no spec way to distinguish between a qualified and 
an unqualified access to a variable, to get or set it.  The [[GetP]] and 
[[SetP]] hooks that are part of ES6 (which is slightly reformulating this), and 
the [[GetOwnProperty]] and [[DefineOwnProperty]] hooks that are part of ES5, do 
not allow passing along qualification.  In the case of getting a property, all 
you get is the object, and the property name being looked up.  In the case of 
setting, you also get the value that goes along.  And if you're defining, you 
get a descriptor with a value and some set of property attributes.  The other 
operations, like [[HasProperty]] and [[HasOwnProperty]], also all take just the 
object and a property name/key.

> And the proposal here is to align with new IE and Opera?

Yes.

Jeff
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to