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

Consider inferring polymer-element tag name for registration #195

Closed
peterwmwong opened this issue Jun 27, 2013 · 1 comment
Closed

Consider inferring polymer-element tag name for registration #195

peterwmwong opened this issue Jun 27, 2013 · 1 comment

Comments

@peterwmwong
Copy link
Contributor

Currently, for registration, the tag name must be provided in 2 places:

<polymer-element name="x-foo"> <!-- #1 -->
   <script>
     Polymer("x-foo",{}); // #2
   </script>
</polymer-element>

Maybe DRY it up and infer the tag name in the script portion of the registration:

<polymer-element name="x-foo">
   <script>
     Polymer({}); // nope
   </script>
</polymer-element>

I would also assume using external script should work aswell:

<polymer-element name="x-foo">
   <script src="x-foo.js"></script>
</polymer-element>
// x-foo.js
Polymer({});

https://groups.google.com/d/msg/polymer-dev/rwX2y0RhNaQ/HyKh3N7WvLMJ

Thanks!

@addyosmani
Copy link
Member

This is an old issue. An element now gets document.registerElement'd simply by defining it as a <polymer-element>.

We also support a noscript version of your earlier example, where registering an element using <­pol­yme­r-e­lement noscri­pt>­<po­lym­er-­ele­men­t> gives you what you're after without having to define the tag name twice. Note: If you opt-in to noscript, you're telling the system it will never see a constructor.

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

2 participants