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

Re: [WebIDL] Dictionary with attribute set to 'undefined' counts as set?

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sat, 14 Jun 2014 22:49:08 -0400
Message-ID: <539D09A4.6070102@mit.edu>
To: public-script-coord@w3.org
On 6/14/14, 1:45 PM, Dirk Schulze wrote:
> If I have a dictionary like this
>
> 	var dic = {x: 1, y: undefined, z: 1, w: 1};
>
> and pass it as argument to DOMPoint:
>
> 	new DOMPoint(dic);
>
> How should the attribute value of DOMPoint.y look like?

 From <http://heycam.github.io/webidl/#es-dictionary> step 5.1.4:

   Otherwise, if value is undefined but the dictionary member has
   a default value, then:

     Let idlValue be the dictionary memberís default value.
     Set the dictionary member on dict with key name key to the value
     idlValue. This dictionary member is considered to be present.

where "value" came from doing a [[Get]] on the object.

So in your case you'd get 0.

-Boris
Received on Sunday, 15 June 2014 02:49:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:21 UTC