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

Crash when Polymer/Platform loaded twice #478

Closed
secretrobotron opened this issue Apr 23, 2014 · 5 comments
Closed

Crash when Polymer/Platform loaded twice #478

secretrobotron opened this issue Apr 23, 2014 · 5 comments

Comments

@secretrobotron
Copy link

If Polymer gets loaded more than once via

  <script src="http://www.polymer-project.org/platform.js"></script>
  <link rel="import" href="http://www.polymer-project.org/polymer.html">

Polymer & Platform will crash. Is there any sane way to recover?

e.g. http://jsbin.com/yisadate/1/edit

Why?!

It would be cool to have documents that contain polymer definitions and markup to display what they are. e.g. Visiting component.html would display information about the component (and even render it!), but using it in a link tag will only pay attention to the <polymer-element>.

@sjmiles
Copy link
Contributor

sjmiles commented Apr 23, 2014

If we made that work, then every time you loaded a component, the browser would reload platform.js and reparse it. This would be bad for performance, and you should not try to do that.

@sjmiles
Copy link
Contributor

sjmiles commented Apr 23, 2014

Note the above is specifically about platform.js. You can replicate the polymer.html import infinity times with no cost. This is built in to the component system, e.g.:

http://jsbin.com/yisadate/2/edit

@secretrobotron
Copy link
Author

Just curious: doesn't the browser reload and reparse platform.js regardless of how many times it's included? Isn't the onus on the developer to not include platform.js more than is necessary?

Note that I'm not saying it's great practice, but it looks as though it actively crashes things when I try. Am I wrong?

@sjmiles
Copy link
Contributor

sjmiles commented Apr 23, 2014

No, you are not wrong. I'm saying there is a disincentive to fix it, because it would allow people to do things which are bad for everybody.

@secretrobotron
Copy link
Author

Good enough :). Thanks!

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

No branches or pull requests

2 participants