- From: <bugzilla@jessica.w3.org>
- Date: Thu, 24 Oct 2013 14:03:33 +0000
- To: public-script-coord@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532 --- Comment #30 from Erik Arvidsson <arv@chromium.org> --- (In reply to Ms2ger from comment #29) > If we want ES and DOM APIs to align, and the DOM APIs have clearly more > useful behaviour, perhaps the ES APIs should change? There is one big difference between DOM APIs and JS. In JS you need to write functions that has optional parameters and calls other functions with optional parameters. In DOM you only need to call functions. If you use arguments.length for these you have to do a lot of boiler plate code to cover all the options. function g(x = undefined, y = undefined, z = undefined) {} function f(x = undefined, y = undefined, z = undefined) { // do something switch (arguments.length) { case 0: return g(); case 1: return g(x); case 2: return g(x, y); default: return g(x, y, z); } } But using the semantics in ES6 function f(x = undefined, y = undefined, z = undefined) { // do something return g(x, y, z); } Also, whether WebIDL has a more useful behavior is debatable. I haven't seen many (any?) JS libraries follow WebIDL. -- You are receiving this mail because: You are on the CC list for the bug.
Received on Thursday, 24 October 2013 14:03:36 UTC