Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-standard globals #341

Closed
timoxley opened this issue Nov 7, 2013 · 5 comments
Closed

non-standard globals #341

timoxley opened this issue Nov 7, 2013 · 5 comments
Assignees

Comments

@timoxley
Copy link

timoxley commented Nov 7, 2013

Polymer is leaking a lot of random stuff into the global namespace. Is there a potential strategy/policy that could be adopted to prevent creation of any non-standard globals other than the absolute bare minimum (e.g. nest everything custom under window.Platform)?

At time of writing, the polymer-platform leaks the following globals. I have taken a stab at which of these are standard, which are non-standard.

Potentially standard

  • Observer
  • ArrayObserver
  • ArraySplice
  • ObjectObserver
  • PathObserver
  • CompoundPathObserver
  • Path
  • ShadowRoot
  • Inspector
  • HTMLImports
  • CustomElements
  • PointerEvent
  • PointerGestures

Potentially non-standard, consider removing:

  • Platform
  • logFlags
  • ShadowDOMPolyfill
  • wrap
  • unwrap
  • templateContent
  • sinspect
  • shadowize
  • esprima
  • PolymerExpressions
  • polymerWrapper_
  • JsMutationObserver
  • PointerEventsPolyfill

There's probably even more globals in the full polymer project.

@timoxley
Copy link
Author

timoxley commented Nov 7, 2013

FWIW use of browserify ala #326 would solve this issue in its entirety as there would be no need to leak anything but require (or whatever you want to name it).

@sjmiles
Copy link
Contributor

sjmiles commented Nov 7, 2013

Only a few of these are actually leaks (Inspector, sinspect, shadowize, and polymerWrapper_).

On top of that, JsMutationObserver can probably be eliminated.

The rest are standalone entities and not leaks. It's not crazy to consider putting them under an umbrella namespace, but that would be a coordination of peers.

Fwiw, Polymer is another global that's not in your list.

@timoxley
Copy link
Author

timoxley commented Nov 8, 2013

Fwiw, Polymer is another global that's not in your list.

Yep, I'm only looking at the platform at the moment. My mental model for the platform was that it was just polyfills, which is why I was surprised all this other non-standard stuff was appearing.

The rest are standalone entities and not leaks.

Are these entities 'standards' though? If not, they should belong in an umbrella namespace. If I pull in a browser library, I expect it to produce at most a single global, otherwise I've got no control over what's going on my environment.

I'll see what can be done and will try come up with some PRs.

@sjmiles sjmiles added cleanup and removed p1 labels Aug 18, 2014
@sjmiles sjmiles added this to the beta milestone Aug 18, 2014
@sjmiles
Copy link
Contributor

sjmiles commented Aug 18, 2014

Although the details have changed, we still need a sweep of all the modules to make sure we are only creating intentional, documented globals .

@tjsavage tjsavage added the 0.5 label May 21, 2015
@tjsavage
Copy link
Contributor

Closing this issue due to age and the release of version 1 of Polymer - please feel free to re-open if this is incorrect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants