| Index: tools/dom/templates/html/impl/impl_Node.darttemplate
|
| diff --git a/tools/dom/templates/html/impl/impl_Node.darttemplate b/tools/dom/templates/html/impl/impl_Node.darttemplate
|
| index 02edf516e2a178334afd16a28d0122af0e83e0f4..2c6669ac04d7a6405979773d12f6fecb724c3565 100644
|
| --- a/tools/dom/templates/html/impl/impl_Node.darttemplate
|
| +++ b/tools/dom/templates/html/impl/impl_Node.darttemplate
|
| @@ -179,6 +179,44 @@ $endif
|
| Node operator[](int index) => _this.$dom_childNodes[index];
|
| }
|
|
|
| +/**
|
| + * The MDV package, if available.
|
| + *
|
| + * This can be used to initialize MDV support via:
|
| + *
|
| + * import 'dart:html';
|
| + * import 'package:mdv/mdv.dart' as mdv;
|
| + * main() {
|
| + * mdv.initialize();
|
| + * }
|
| + */
|
| +Function mdvPackage = (node) {
|
| + throw new UnsupportedError("The MDV package is not available. "
|
| + "You can enable it with `import 'package:mdv/mdv.dart' as mdv;` and "
|
| + "`mdv.initialize()`");
|
| +};
|
| +
|
| +/** Information about the instantiated template. */
|
| +class TemplateInstance {
|
| + // TODO(rafaelw): firstNode & lastNode should be read-synchronous
|
| + // in cases where script has modified the template instance boundary.
|
| +
|
| + /** The first node of this template instantiation. */
|
| + final Node firstNode;
|
| +
|
| + /**
|
| + * The last node of this template instantiation.
|
| + * This could be identical to [firstNode] if the template only expanded to a
|
| + * single node.
|
| + */
|
| + final Node lastNode;
|
| +
|
| + /** The model used to instantiate the template. */
|
| + final model;
|
| +
|
| + TemplateInstance(this.firstNode, this.lastNode, this.model);
|
| +}
|
| +
|
| $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
|
| List<Node> get nodes {
|
| return new _ChildNodeListLazy(this);
|
| @@ -258,26 +296,24 @@ $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
|
| */
|
| @Experimental
|
| void bind(String name, model, String path) {
|
| - // TODO(jmesserly): should we throw instead?
|
| - window.console.error('Unhandled binding to Node: '
|
| - '$this $name $model $path');
|
| + mdvPackage(this).bind(name, model, path);
|
| }
|
|
|
| /** Unbinds the attribute [name]. */
|
| @Experimental
|
| - void unbind(String name) {}
|
| + void unbind(String name) {
|
| + mdvPackage(this).unbind(name);
|
| + }
|
|
|
| /** Unbinds all bound attributes. */
|
| @Experimental
|
| - void unbindAll() {}
|
| -
|
| - TemplateInstance _templateInstance;
|
| + void unbindAll() {
|
| + mdvPackage(this).unbindAll();
|
| + }
|
|
|
| /** Gets the template instance that instantiated this node, if any. */
|
| @Experimental
|
| - TemplateInstance get templateInstance =>
|
| - _templateInstance != null ? _templateInstance :
|
| - (parent != null ? parent.templateInstance : null);
|
| + TemplateInstance get templateInstance => mdvPackage(this).templateInstance;
|
|
|
| $!MEMBERS
|
| }
|
|
|