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="sky-binder.sky" as="binder" /> | 6 <import src="sky-binder.sky" as="binder" /> |
7 <script> | 7 <script> |
8 var templates = new Map(); | 8 var templates = new Map(); |
9 | 9 |
10 var attributeConverters = { | 10 var attributeConverters = { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 shadowRootReady() { | 96 shadowRootReady() { |
97 // override | 97 // override |
98 } | 98 } |
99 | 99 |
100 createdCallback() { | 100 createdCallback() { |
101 this.isAttached = false; | 101 this.isAttached = false; |
102 this.created(); | 102 this.created(); |
103 | 103 |
| 104 Object.preventExtensions(this); |
| 105 |
104 // Invoke attributeChanged callback when element is first created too. | 106 // Invoke attributeChanged callback when element is first created too. |
105 var attributes = this.getAttributes(); | 107 var attributes = this.getAttributes(); |
106 for (var i = 0; i < attributes.length; ++i) { | 108 for (var i = 0; i < attributes.length; ++i) { |
107 var attribute = attributes[i]; | 109 var attribute = attributes[i]; |
108 this.attributeChangedCallback(attribute.name, null, attribute.value); | 110 this.attributeChangedCallback(attribute.name, null, attribute.value); |
109 } | 111 } |
110 } | 112 } |
111 | 113 |
112 attachedCallback() { | 114 attachedCallback() { |
113 if (!this.shadowRoot) { | 115 if (!this.shadowRoot) { |
(...skipping 29 matching lines...) Expand all Loading... |
143 oldValue: oldValue, | 145 oldValue: oldValue, |
144 }); | 146 }); |
145 var handler = this[name + 'Changed']; | 147 var handler = this[name + 'Changed']; |
146 if (typeof handler == 'function') | 148 if (typeof handler == 'function') |
147 handler.call(this, oldValue, newValue); | 149 handler.call(this, oldValue, newValue); |
148 } | 150 } |
149 }; | 151 }; |
150 | 152 |
151 module.exports = SkyElement; | 153 module.exports = SkyElement; |
152 </script> | 154 </script> |
OLD | NEW |