Re: Getters establish own properties, or why is [NamedPropertiesObject] discouraged?

On 2/24/12 1:05 PM, Garrett Smith wrote:
> No, using getter/setter instead does not mean that the properties are
> "own".

Per current webidl spec, defining a "getter" or "setter" on the 
interface does mean the properties involved are own properties.  Please 
see the spec.

> In fact, it is often the case where an object's getter or
> setter resides on the prototype chain. For example, the style
> property, in Gecko is a getter on the prototype chain:-
>
> document.body.hasOwnProperty("style");.

That's not a "getter" in the IDL.

Try something more like this:

   <body name="foo">
   <script>
     alert(document.getElementsByTagName("body").hasOwnProperty("foo"));
   </script>

-Boris

Received on Friday, 24 February 2012 18:13:43 UTC