[whatwg] Questions regarding Path object

Juriy Zaytsev kangax at gmail.com
Fri Sep 20 11:33:41 PDT 2013


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 at 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
>
>



More information about the whatwg mailing list