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

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

Issue 14795005: Add support for custom elements to MDV (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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/src/TemplateBindings.dart ('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_Element.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index e4faf0ceb80daa8267c5bc0bd2213b8198ae2e23..8c342fd998e1e3be471d371eaee98110815c8560 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -424,20 +424,29 @@ $(ANNOTATIONS)abstract class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
void onCreated() {}
// Hooks to support custom WebComponents.
+
+$if DART2JS
+ @Creates('Null') // Set from Dart code; does not instantiate a native type.
+$endif
+ Element _xtag;
+
/**
* Experimental support for [web components][wc]. This field stores a
* reference to the component implementation. It was inspired by Mozilla's
* [x-tags][] project. Please note: in the future it may be possible to
* `extend Element` from your class, in which case this field will be
- * deprecated and will simply return this [Element] object.
+ * deprecated.
+ *
+ * If xtag has not been set, it will simply return `this` [Element].
*
* [wc]: http://dvcs.w3.org/hg/webcomponents/raw-file/tip/explainer/index.html
* [x-tags]: http://x-tags.org/
*/
-$if DART2JS
- @Creates('Null') // Set from Dart code; does not instantiate a native type.
-$endif
- var xtag;
+ Element get xtag => _xtag != null ? _xtag : this;
+
+ void set xtag(Element value) {
+ _xtag = value;
+ }
/**
* Scrolls this element into view.
@@ -674,7 +683,7 @@ $endif
self._attributeBindings = new Map<String, StreamSubscription>();
}
- self.attributes.remove(name);
+ self.xtag.attributes.remove(name);
var changed;
if (name.endsWith('?')) {
@@ -682,16 +691,16 @@ $endif
changed = (value) {
if (_templateBooleanConversion(value)) {
- self.attributes[name] = '';
+ self.xtag.attributes[name] = '';
} else {
- self.attributes.remove(name);
+ self.xtag.attributes.remove(name);
}
};
} else {
changed = (value) {
// TODO(jmesserly): escape value if needed to protect against XSS.
// See https://github.com/toolkitchen/mdv/issues/58
- self.attributes[name] = value == null ? '' : '$value';
+ self.xtag.attributes[name] = value == null ? '' : '$value';
};
}
« no previous file with comments | « tools/dom/src/TemplateBindings.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698