PSA: <element> is gone, all hail <polymer-element>

54 views
Skip to first unread message

Daniel Freedman

unread,
Jun 26, 2013, 5:36:35 PM6/26/13
to polymer-dev
bcc: polymer-announce

The Polymer team is happy to announce another reboot of custom element registration. Instead of <element>, there will be <polymer-element>.

New features:
  • Auto declaration: <polymer-element name="x-foo"></polymer-element> will work without script tags
  • Script is decoupled from the element:
    • <script src> should work now
    • <script> can come before or inside the element, but not after (because of auto register timing)
Changes:
  • Polymer.register( this, {prototype} ) is now Polymer( "tag name", { prototype } )
    • Easier to type, and allows for the script decoupling
    • Thin suger over document.register
  • Script scope is no longer special
    • Had to go to allow for separate scripts
    • No closure, private variables and such should be done with the standard methods like IFFEs
This change will be made to the master branch of polymer, polymer-elements, polymer-ui-elements, toolkit-ui, todomvc, projects, and more-elements.

Thanks!

Daniel Freedman

unread,
Jun 26, 2013, 5:47:27 PM6/26/13
to polymer-dev
bcc: polymer-announce
Clarification:
<element> still exists, but is out of date with the Custom Elements spec.
The changes required by the spec will break current Polymer usage with Polymer.register.
Therefore, all new elements should be written with <polymer-element>.

Daniel Freedman

unread,
Jun 26, 2013, 6:10:50 PM6/26/13
to polymer-dev
Reply all
Reply to author
Forward
0 new messages