Index: tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate |
diff --git a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate |
index 973c9d45e0219fd236128b8ce5343f2044138f7d..3e44809eb5ab119c99c4fcb60c27b61190808dba 100644 |
--- a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate |
+++ b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate |
@@ -244,32 +244,6 @@ $endif |
* This custom element can also be instantiated via HTML using the syntax |
* `<input is="x-bar"></input>` |
* |
- * The [nativeTagName] parameter is needed by platforms without native support |
- * when subclassing a native type other than: |
- * |
- * * HtmlElement |
- * * SvgElement |
- * * AnchorElement |
- * * AudioElement |
- * * ButtonElement |
- * * CanvasElement |
- * * DivElement |
- * * ImageElement |
- * * InputElement |
- * * LIElement |
- * * LabelElement |
- * * MenuElement |
- * * MeterElement |
- * * OListElement |
- * * OptionElement |
- * * OutputElement |
- * * ParagraphElement |
- * * PreElement |
- * * ProgressElement |
- * * SelectElement |
- * * SpanElement |
- * * UListElement |
- * * VideoElement |
*/ |
$if DART2JS |
void register(String tag, Type customElementClass, {String extendsTag}) { |
@@ -321,4 +295,30 @@ $endif |
@Experimental() |
Stream<Event> get onVisibilityChange => |
visibilityChangeEvent.forTarget(this); |
+ |
+ /// Creates an element upgrader which can be used to change the Dart wrapper |
+ /// type for elements. |
+ /// |
+ /// The type specified must be a subclass of HtmlElement, when an element is |
+ /// upgraded then the created constructor will be invoked on that element. |
+ /// |
+ /// If the type is not a direct subclass of HtmlElement then the extendsTag |
+ /// parameter must be provided. |
+ @Experimental() |
+ ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { |
+$if DART2JS |
+ return new _JSElementUpgrader(this, type, extendsTag); |
+$else |
+ return new _VMElementUpgrader(this, type, extendsTag); |
+$endif |
+ } |
+} |
+ |
+/// A utility for changing the Dart wrapper type for elements. |
+abstract class ElementUpgrader { |
+ /// Upgrade the specified element to be of the Dart type this was created for. |
+ /// |
+ /// After upgrading the element passed in is invalid and the returned value |
+ /// should be used instead. |
+ Element upgrade(Element element); |
} |