| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // TODO(jmesserly): Remove this file when our version >= 0.2, and merge | 5 // TODO(jmesserly): Remove this file when our version >= 0.2, and merge |
| 6 // this with "web_components.dart". Leaving for now to keep 0.1.x compat. | 6 // this with "web_components.dart". Leaving for now to keep 0.1.x compat. |
| 7 /** Declares the [WebComponent] base class (eventually: mixin). */ | 7 /** Declares the [WebComponent] base class (eventually: mixin). */ |
| 8 library web_component; | 8 library web_component; |
| 9 | 9 |
| 10 import 'dart:html'; | 10 import 'dart:html'; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 final Element _element; | 22 final Element _element; |
| 23 | 23 |
| 24 static bool _hasShadowRoot = true; | 24 static bool _hasShadowRoot = true; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Default constructor for web components. This contructor is only provided | 27 * Default constructor for web components. This contructor is only provided |
| 28 * for tooling, and is *not* currently supported. | 28 * for tooling, and is *not* currently supported. |
| 29 * Use [WebComponent.forElement] instead. | 29 * Use [WebComponent.forElement] instead. |
| 30 */ | 30 */ |
| 31 WebComponent() : _element = null { | 31 WebComponent() : _element = null { |
| 32 throw new UnsupportedOperationException( | 32 throw new UnsupportedError( |
| 33 'Directly constructing web components is not currently supported. ' | 33 'Directly constructing web components is not currently supported. ' |
| 34 'You need to use the WebComponent.forElement constructor to associate ' | 34 'You need to use the WebComponent.forElement constructor to associate ' |
| 35 'a component with its DOM element. If you run "bin/dwc.dart" on your ' | 35 'a component with its DOM element. If you run "bin/dwc.dart" on your ' |
| 36 'component, the compiler will create the approriate construction ' | 36 'component, the compiler will create the approriate construction ' |
| 37 'logic.'); | 37 'logic.'); |
| 38 } | 38 } |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Temporary constructor until components extend [Element]. Attaches this | 41 * Temporary constructor until components extend [Element]. Attaches this |
| 42 * component to the provided [element]. The element must not already have a | 42 * component to the provided [element]. The element must not already have a |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 _element.$dom_replaceChild(newChild, oldChild); | 338 _element.$dom_replaceChild(newChild, oldChild); |
| 339 | 339 |
| 340 get xtag => _element.xtag; | 340 get xtag => _element.xtag; |
| 341 | 341 |
| 342 set xtag(value) { _element.xtag = value; } | 342 set xtag(value) { _element.xtag = value; } |
| 343 | 343 |
| 344 void addText(String text) => _element.addText(text); | 344 void addText(String text) => _element.addText(text); |
| 345 | 345 |
| 346 void addHTML(String html) => _element.addHTML(html); | 346 void addHTML(String html) => _element.addHTML(html); |
| 347 } | 347 } |
| OLD | NEW |