UNPKG

five-bells-visualization

Version:
83 lines (61 loc) 2.26 kB
<!-- @license Copyright (c) 2014 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <!-- **THIS ELEMENT IS EXPERIMENTAL. API AND NAME SUBJECT TO CHANGE.** Polymer's binding features are only available within templates that are managed by Polymer. As such, these features are available in templates used to define Polymer elements, for example, but not for elements placed directly in the main document. In order to use Polymer bindings without defining a new custom element, elements utilizing bindings may be wrapped with the `x-autobind` template extension. This template will immediately stamp itself into the main document and bind elements to the template itself as the binding scope. ```html <!doctype html> <html> <head> <meta charset="utf-8"> <script src="components/webcomponentsjs/webcomponents-lite.js"></script> <link rel="import" href="components/polymer/polymer.html"> <link rel="import" href="components/core-ajax/core-ajax.html"> </head> <body> <template is="x-autobind"> <core-ajax url="http://..." lastresponse="{{data}}"></core-ajax> <template is="x-repeat" items="{{data}}"> <div><span>{{item.first}}</span> <span>{{item.last}}</span></div> </template> </template> </body> </html> ``` --> <script> Polymer({ is: 'x-autobind', extends: 'template', _registerFeatures: function() { this._prepExtends(); this._prepConstructor(); }, _finishDistribute: function() { var parentDom = Polymer.dom(Polymer.dom(this).parentNode); parentDom.insertBefore(this.root, this); }, _initFeatures: function() { this._template = this; this._prepAnnotations(); this._prepEffects(); this._prepBehaviors(); this._prepBindings(); Polymer.Base._initFeatures.call(this); } }); </script>