Skip to content

Consider inferring polymer-element tag name for registration #195

Description

@peterwmwong

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!

Activity

  1. addyosmani commented on Mar 16, 2014

    @addyosmani
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions