| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 <link rel="import" href="TemplateBinding.sky" /> | 6 <link rel="import" href="TemplateBinding.sky" /> |
| 7 <script> | 7 <script> |
| 8 var Base = Object.create(HTMLElement.prototype, { | 8 var Base = { |
| 9 __proto__: HTMLElement.prototype, |
| 10 |
| 9 register: function() { | 11 register: function() { |
| 10 // |this| is prototype | 12 // |this| is prototype |
| 11 var template = document.currentScript.previousElementSibling; | 13 var template = document.currentScript.previousElementSibling; |
| 12 if (template && template.localName == 'template') | 14 if (template && template.localName == 'template') |
| 13 this.template_ = template; | 15 this.template_ = template; |
| 14 }, | 16 }, |
| 15 | 17 |
| 16 createdCallback: function() { | 18 createdCallback: function() { |
| 17 }, | 19 }, |
| 18 | 20 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 34 // override | 36 // override |
| 35 }, | 37 }, |
| 36 | 38 |
| 37 attributeChangedCallback: function(attrName, oldValue, newValue) { | 39 attributeChangedCallback: function(attrName, oldValue, newValue) { |
| 38 // reserved for canonical behavior | 40 // reserved for canonical behavior |
| 39 this.attributeChanged(attrName, oldValue, newValue); | 41 this.attributeChanged(attrName, oldValue, newValue); |
| 40 }, | 42 }, |
| 41 | 43 |
| 42 attributeChanged: function(attrName, oldValue, newValue) { | 44 attributeChanged: function(attrName, oldValue, newValue) { |
| 43 // override | 45 // override |
| 44 }, | 46 } |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 function SkyElement(prototype) { | 49 function SkyElement(prototype) { |
| 48 prototype.__proto__ = Base; | 50 prototype.__proto__ = Base; |
| 49 document.registerElement(prototype.name, { prototype: prototype }); | 51 document.registerElement(prototype.name, { prototype: prototype }); |
| 50 prototype.register(); | 52 prototype.register(); |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 module.exports = SkyElement; | 55 module.exports = SkyElement; |
| 54 </script> | 56 </script> |
| OLD | NEW |