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

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?

Hi,

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

Greetings,
Dirk

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