OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. |
| 5 --> |
| 6 <link rel="import" href="TemplateBinding.sky" /> |
| 7 |
| 8 <script> |
| 9 (function(global) { |
| 10 'use strict'; |
| 11 |
| 12 // var bindigDelegate = new PolymerExpressions; |
| 13 var bindingDelegate; |
| 14 |
| 15 var Base = { |
| 16 |
| 17 __proto__: HTMLElement.prototype, |
| 18 |
| 19 register: function() { |
| 20 // This is prototype |
| 21 var template = document.currentScript.previousElementSibling; |
| 22 if (template && template.localName == 'template') { |
| 23 this.template_ = template; |
| 24 } |
| 25 }, |
| 26 |
| 27 createdCallback: function() { |
| 28 }, |
| 29 |
| 30 attachedCallback: function() { |
| 31 var shadow = this.createShadowRoot(); |
| 32 shadow.appendChild(this.template_.createInstance(this, bindingDelegate)); |
| 33 this.attached(); |
| 34 }, |
| 35 |
| 36 attached: function() { |
| 37 // override |
| 38 }, |
| 39 |
| 40 dettachedCallback: function() { |
| 41 this.dettached(); |
| 42 }, |
| 43 |
| 44 dettached: function() { |
| 45 // override |
| 46 }, |
| 47 |
| 48 attributeChangedCallback: function(attrName, oldValue, newValue) { |
| 49 // reserved for canonical behavior |
| 50 this.attributeChanged(attrName, oldValue, newValue); |
| 51 }, |
| 52 |
| 53 attributeChanged: function(attrName, oldValue, newValue) { |
| 54 // for overriding |
| 55 } |
| 56 }; |
| 57 |
| 58 function SkyElement(prototype) { |
| 59 prototype.__proto__ = Base; |
| 60 document.registerElement(prototype.name, { prototype: prototype }); |
| 61 prototype.register(); |
| 62 }; |
| 63 |
| 64 module.exports = SkyElement; |
| 65 })(this); |
| 66 </script> |
OLD | NEW |