W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2013

Re: [whatwg] Questions regarding Path object

From: Juriy Zaytsev <kangax@gmail.com>
Date: Fri, 20 Sep 2013 20:33:41 +0200
Message-ID: <CAPdhPzkcXTwGd8XF1rKZ7u5RrRbB6P9eB1dEWu8ajCj6K7Z+Vg@mail.gmail.com>
To: Jürg Lehni <lists@scratchdisk.com>
Cc: Dirk Schulze <dschulze@adobe.com>, "whatwg@lists.whatwg.org" <whatwg@lists.whatwg.org>, Rik Cabanier <cabanier@gmail.com>, Ian Hickson <ian@hixie.ch>, Simon Pieters <simonp@opera.com>
FWIW, in Fabric.js [1], everything is scoped under global `fabric` object.
`fabric.Path`, `fabric.Circle`, `fabric.Color`, etc. For any third-party
library in a cross-browser environment, this has been the only sane
strategy of avoiding conflicts and keeping things scalable.

We learned about "global everything" problems back in the Prototype.js [2]
days :)

After all, "injection" could always be done on a local level:

(function() {
  var Path = fabric.Path, Circle = fabric.Circle, etc.
  ...
  new Path();
  ...
})();

I also don't see much simplicity in using global names. It's just
irresponsible and asking for trouble.

[1] http://fabricjs.com
[2] http://prototypejs.org

-- 
kangax


On Fri, Sep 20, 2013 at 8:16 PM, Jürg Lehni <lists@scratchdisk.com> wrote:

> PS: iOS 7 is barely released, but the first bug reports are already coming
> in, because the new Mobile Safari now defines Path, and clashes:
>
> https://twitter.com/danetag/status/380636739251220480
>
>
Received on Friday, 20 September 2013 18:34:26 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:09 UTC