[whatwg] Questions regarding Path object

Tobias R. tag+whatwg at basecode.de
Fri Nov 15 05:59:22 PST 2013

On Wed, Nov 6, 2013 at 12:41 PM, Jürg Lehni <lists at scratchdisk.com> wrote:
> On Nov 4, 2013, at 13:32 , Anne van Kesteren <annevk at annevk.nl> wrote:
>> Objects not having constructors is a bad API practice we are moving away from.
> I'm not sure everybody thinks so. There are whole libraries out there that avoid the use of 'new' in favor of functions that create the objects for you (e.g. Two.js, Raphael.js, etc). Douglas Crockford amongst others is advocating against the use of 'new' for a long time.

That's very subjective :)  No one is seriously advocating against the
"new" operator. Some people are pointing to the fact that
(accidentally) omitting the new operator can lead to unexpected
behaviour and that's it. "new" in fact creates a *new* instance.

> We're used to calling document.createElement(), etc. To me it feels strange that all of a sudden, browser provided functionality is not bound to a context, but is implemented by such a free-floating constructor.

The missing context can be actually considered as a feature. Sharing
functionality between "web" API (canvas / svg / css-mask) looks like a
big step forward.

More information about the whatwg mailing list