Re: Should properties on the named properties object be readonly?

If you initialize [[Writable]] to true, allow assignments, and have the
resulting value be the value assigned, why not have [[DefineOwnProperty]]
also succeed for these cases?

On Thu, Apr 2, 2015 at 2:56 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> 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
>
>


-- 
    Cheers,
    --MarkM

Received on Thursday, 2 April 2015 19:04:28 UTC