Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1969)

Unified Diff: tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate

Issue 23190026: Type extension support in polyfill. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/dom/templates/html/impl/impl_Element.darttemplate ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6887091dacdf3c07dd1f361bc3d69e8aa8a648cd..3f01140d8a61845fcd6b47a490eb38e00349bc61 100644
--- a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
@@ -167,13 +167,81 @@ $endif
String get visibilityState => _webkitVisibilityState;
@Experimental
+ /**
+ * Register a custom subclass of Element to be instantiatable by the DOM.
+ *
+ * This is necessary to allow the construction of any custom elements.
+ *
+ * The class being registered must either subclass HtmlElement or SvgElement.
+ * If they subclass these directly then they can be used as:
+ *
+ * class FooElement extends HtmlElement{
+ * void created() {
+ * print('FooElement created!');
+ * }
+ * }
+ *
+ * main() {
+ * document.register('x-foo', FooElement);
+ * var myFoo = new Element.tag('x-foo');
+ * // prints 'FooElement created!' to the console.
+ * }
+ *
+ * The custom element can also be instantiated via HTML using the syntax
+ * `<x-foo></x-foo>`
+ *
+ * Other elements can be subclassed as well:
+ *
+ * class BarElement extends InputElement{
+ * void created() {
+ * print('BarElement created!');
+ * }
+ * }
+ *
+ * main() {
+ * document.register('x-bar', BarElement);
+ * var myBar = new Element.tag('input', 'x-bar');
+ * // prints 'BarElement created!' to the console.
+ * }
+ *
+ * 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) {
- _registerCustomElement(JS('', 'window'), this, tag, customElementClass);
+ void register(String tag, Type customElementClass, {String nativeTagName}) {
+ _registerCustomElement(JS('', 'window'), this, tag, customElementClass,
+ nativeTagName);
}
$else
- void register(String tag, Type custom) {
- _Utils.register(tag, custom);
+ void register(String tag, Type customElementClass, {String nativeTagName}) {
+ _Utils.register(tag, customElementClass);
}
$endif
« no previous file with comments | « tools/dom/templates/html/impl/impl_Element.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698