| 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 <import src="TemplateBinding.sky" /> | 6 <import src="TemplateBinding.sky" /> |
| 7 <script> | 7 <script> |
| 8 var templates = new Map(); | 8 var templates = new Map(); |
| 9 | 9 |
| 10 class SkyElement extends HTMLElement { | 10 class SkyElement extends HTMLElement { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 dettached() { | 39 dettached() { |
| 40 // override | 40 // override |
| 41 } | 41 } |
| 42 | 42 |
| 43 attributeChanged(attrName, oldValue, newValue) { | 43 attributeChanged(attrName, oldValue, newValue) { |
| 44 // override | 44 // override |
| 45 } | 45 } |
| 46 | 46 |
| 47 shadowRootReady() { |
| 48 // override |
| 49 } |
| 50 |
| 47 createdCallback() { | 51 createdCallback() { |
| 48 this.created(); | 52 this.created(); |
| 49 } | 53 } |
| 50 | 54 |
| 51 attachedCallback() { | 55 attachedCallback() { |
| 52 if (!this.shadowRoot) { | 56 if (!this.shadowRoot) { |
| 53 var template = templates.get(this.localName); | 57 var template = templates.get(this.localName); |
| 54 if (template) { | 58 if (template) { |
| 55 var shadow = this.ensureShadowRoot(); | 59 var shadow = this.ensureShadowRoot(); |
| 56 shadow.appendChild(template.createInstance(this)); | 60 shadow.appendChild(template.createInstance(this)); |
| 61 this.shadowRootReady(); |
| 57 } | 62 } |
| 58 } | 63 } |
| 59 this.attached(); | 64 this.attached(); |
| 60 } | 65 } |
| 61 | 66 |
| 62 dettachedCallback() { | 67 dettachedCallback() { |
| 63 this.dettached(); | 68 this.dettached(); |
| 64 } | 69 } |
| 65 | 70 |
| 66 attributeChangedCallback(attrName, oldValue, newValue) { | 71 attributeChangedCallback(attrName, oldValue, newValue) { |
| 67 // reserved for canonical behavior | 72 // reserved for canonical behavior |
| 68 this.attributeChanged(attrName, oldValue, newValue); | 73 this.attributeChanged(attrName, oldValue, newValue); |
| 69 } | 74 } |
| 70 }; | 75 }; |
| 71 | 76 |
| 72 module.exports = SkyElement; | 77 module.exports = SkyElement; |
| 73 </script> | 78 </script> |
| OLD | NEW |