| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Custom Elements let authors define their own elements. Authors associate code | 6 * Custom Elements let authors define their own elements. Authors associate code |
| 7 * with custom tag names, and then use those custom tag names as they would any | 7 * with custom tag names, and then use those custom tag names as they would any |
| 8 * standard tag. See <www.polymer-project.org/platform/custom-elements.html> | 8 * standard tag. See <www.polymer-project.org/platform/custom-elements.html> |
| 9 * for more information. | 9 * for more information. |
| 10 */ | 10 */ |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 * Initialize any registered custom elements recursively in the [node] tree. | 79 * Initialize any registered custom elements recursively in the [node] tree. |
| 80 * For convenience this returns the [node] instance. | 80 * For convenience this returns the [node] instance. |
| 81 * | 81 * |
| 82 * *Warning*: this API is temporary until [dart:html] supports custom elements. | 82 * *Warning*: this API is temporary until [dart:html] supports custom elements. |
| 83 */ | 83 */ |
| 84 Node initCustomElements(Node node) { | 84 Node initCustomElements(Node node) { |
| 85 for (var c = node.firstChild; c != null; c = c.nextNode) { | 85 for (var c = node.firstChild; c != null; c = c.nextNode) { |
| 86 initCustomElements(c); | 86 initCustomElements(c); |
| 87 } | 87 } |
| 88 if (node is Element) { | 88 if (node is Element) { |
| 89 var ctor = _customElements[node.localName]; | 89 var ctor = _customElements[(node as Element).localName]; |
| 90 if (ctor == null) { | 90 if (ctor == null) { |
| 91 var attr = node.attributes['is']; | 91 var attr = (node as Element).attributes['is']; |
| 92 if (attr != null) ctor = _customElements[attr]; | 92 if (attr != null) ctor = _customElements[attr]; |
| 93 } | 93 } |
| 94 if (ctor != null) _initCustomElement(node, ctor); | 94 if (ctor != null) _initCustomElement(node, ctor); |
| 95 } | 95 } |
| 96 return node; | 96 return node; |
| 97 } | 97 } |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * The base class for all Dart web components. In addition to the [Element] | 100 * The base class for all Dart web components. In addition to the [Element] |
| 101 * interface, it also provides lifecycle methods: | 101 * interface, it also provides lifecycle methods: |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 for (var removed in record.removedNodes) { | 659 for (var removed in record.removedNodes) { |
| 660 if (identical(node, removed)) { | 660 if (identical(node, removed)) { |
| 661 observer.disconnect(); | 661 observer.disconnect(); |
| 662 element.removed(); | 662 element.removed(); |
| 663 return; | 663 return; |
| 664 } | 664 } |
| 665 } | 665 } |
| 666 } | 666 } |
| 667 }).observe(element.parentNode, childList: true); | 667 }).observe(element.parentNode, childList: true); |
| 668 } | 668 } |
| OLD | NEW |