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

RE: [WebIDL] Constructor with too many arguments throws TypeError?

From: Domenic Denicola <domenic@domenicdenicola.com>
Date: Sat, 14 Jun 2014 17:52:22 +0000
To: Dirk Schulze <dschulze@adobe.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <7e05a74984734f91823c3c808e1eed2e@BN1PR05MB325.namprd05.prod.outlook.com>
It should be valid; "extra" parameters to a function in JavaScript are simply ignored.

-----Original Message-----
From: Dirk Schulze [mailto:dschulze@adobe.com] 
Sent: Saturday, June 14, 2014 13:50
To: public-script-coord@w3.org
Subject: [WebIDL] Constructor with too many arguments throws TypeError?

Hi,

If I have a constructor that takes 4 arguments. If I pass 5 arguments, will it throw a TypeError exception?

Example:

[Constructor(unrestricted double x, unrestricted double y,
             unrestricted double width, unrestricted double height)] interface DOMRect : DOMRectReadOnly { ... }

Is

	new DOMRect(1, 2, 3, 4, 5);

valid and creates a DOMRect object or should it throw a TypeError exception? I am asking because the general behavior is not interoperable across browsers today.

Greetings,
Dirk
Received on Saturday, 14 June 2014 17:52:51 UTC

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