W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2015

Should properties on the named properties object be readonly?

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Thu, 02 Apr 2015 14:56:52 -0400
Message-ID: <551D90F4.6030605@mit.edu>
To: "public-script-coord@w3.org" <public-script-coord@w3.org>
Per current Web IDL spec, they are: 
http://heycam.github.io/webidl/#named-properties-object-getownproperty 
does "Set desc.[[Writable]] to false" in step 8.

However, not a single UA implements this.  Simple testcase:

   <div id="x"></div>
   <script>
     x = 5;
     alert(x);
   </script>

This alerts "5", not "[object HTMLDivElement]" in Firefox, Chrome, 
Safari, IE11, and Presto Opera.  Per current spec it should be alerting 
"[object HTMLDivElement]".

I think we should just change the spec here.  Specifically, set 
[[Writable]] to true, which will allow shadowing assignments, while 
continuing to return false from [[DefineOwnProperty]] (so if you try to 
actually set the property directly on the named properties object you 
either no-op or throw depending on strict mode and whatnot).

Any objections?

-Boris
Received on Thursday, 2 April 2015 18:57:20 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 2 April 2015 18:57:21 UTC