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

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

From: Mark S. Miller <erights@google.com>
Date: Thu, 2 Apr 2015 15:04:00 -0400
Message-ID: <CABHxS9jthChboSjs2ftBKeS3K8unOBFGb_4jpGwfd=wD+bjF=A@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
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

This archive was generated by hypermail 2.3.1 : Thursday, 2 April 2015 19:04:28 UTC