| 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';
|
| };
|
| }
|
|
|
|
|