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

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

Issue 24653006: Adding Element.created constructor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding createCallback to custom_element.dart Created 7 years, 3 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
Index: tools/dom/templates/html/impl/impl_Element.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 5732c1ebd5469464a8cdc917a75156394a97d705..0e76f3819dc4742d21490654af70601567797850 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -334,6 +334,30 @@ $(ANNOTATIONS)abstract class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
}
/**
+ * Custom element creation constructor.
+ *
+ * This constructor is used by the DOM when a custom element has been
+ * created. It can only be invoked by subclasses of Element from
+ * that classes created constructor.
+ *
+ * class CustomElement extends Element {
+ * factory CustomElement() => new Element.tag('x-custom');
+ *
+ * CustomElement.created(): super.created() {
+ * // Perform any element initialization.
+ * }
+ * }
+ * document.register('x-custom', CustomElement);
+ */
+ Element.created(): super._created() {
+ // Validate that this is a custom element & perform any additional
+ // initialization.
+ _initializeCustomElement(this);
+
+ createdCallback();
+ }
+
+ /**
* Creates the HTML element specified by the tag name.
*
* This is similar to [Document.createElement].
@@ -678,7 +702,7 @@ $(ANNOTATIONS)abstract class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
* Called by the DOM when this element has been instantiated.
*/
@Experimental()
- void created() {}
+ void createdCallback() {}
/**
* Called by the DOM when this element has been inserted into the live

Powered by Google App Engine
This is Rietveld 408576698