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

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