OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library web_components.custom_element; | 4 library web_components.custom_element; |
5 | 5 |
6 import 'dart:html' show document; | 6 import 'dart:html' show document; |
7 import 'package:initialize/initialize.dart'; | 7 import 'package:initialize/initialize.dart'; |
8 | 8 |
9 /// Annotation which registers a custom element with the main document. | 9 /// Annotation which registers a custom element with the main document. |
10 class CustomElement implements Initializer<Type> { | 10 class CustomElement implements Initializer<Type> { |
11 /// The tag you want to register the class to handle. | 11 /// The tag you want to register the class to handle. |
12 final String tag; | 12 final String tag; |
13 | 13 |
14 /// If this element extends a native html element, then this is the tag that | 14 /// If this element extends a native html element, then this is the tag that |
15 /// represents that element. | 15 /// represents that element. |
16 final String extendsTag; | 16 final String extendsTag; |
17 | 17 |
18 const CustomElement(this.tag, {this.extendsTag}); | 18 const CustomElement(this.tag, {this.extendsTag}); |
19 | 19 |
20 void initialize(Type t) => | 20 void initialize(Type t) => |
21 document.registerElement(tag, t, extendsTag: extendsTag); | 21 document.registerElement(tag, t, extendsTag: extendsTag); |
22 } | 22 } |
OLD | NEW |