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: Domenic Denicola <domenic@domenicdenicola.com>
Date: Sat, 14 Jun 2014 17:51:16 +0000
To: Dirk Schulze <dschulze@adobe.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <b55d755be35e43e6a79eb54956611f72@BN1PR05MB325.namprd05.prod.outlook.com>
It should be a), for consistency with ECMAScript destructuring and defaulting semantics:

http://www.es6fiddle.net/hwf7zblx/ (press the "play" button)

-----Original Message-----
From: Dirk Schulze [mailto:dschulze@adobe.com] 
Sent: Saturday, June 14, 2014 13:45
To: public-script-coord@w3.org
Subject: [WebIDL] Dictionary with attribute set to 'undefined' counts as set?


I have a question to dictionaries:

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?

Should it be:
a) 0 because dic.y doesn't count as initialized and it take the default initial value of DOMPoint.y?
b) NaN because dic.y counts as initialized and undefined is transformed to NaN since the attribute value of y is of type Number?

The relevant spec is Geometry Interfaces. The relevant IDL looks like this:

dictionary DOMPointInit {
    unrestricted double x = 0;
    unrestricted double y = 0;
    unrestricted double z = 0;
    unrestricted double w = 1;

[Constructor(optional DOMPointInit point)] interface DOMPoint : DOMPointReadOnly {
    inherit attribute unrestricted double x;
    inherit attribute unrestricted double y;
    inherit attribute unrestricted double z;
    inherit attribute unrestricted double w; }

Received on Saturday, 14 June 2014 17:51:58 UTC

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