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

Unified Diff: tools/dom/src/TemplateBindings.dart

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
Index: tools/dom/src/TemplateBindings.dart
diff --git a/tools/dom/src/TemplateBindings.dart b/tools/dom/src/TemplateBindings.dart
index 5192927966d7bb961e7fc0b1678305854784cab8..783362ccb1a66d9fa63fc4cfaa9fd8f1460f3a7e 100644
--- a/tools/dom/src/TemplateBindings.dart
+++ b/tools/dom/src/TemplateBindings.dart
@@ -523,7 +523,7 @@ void _parseAndBind(Node node, String name, String text, model,
return newValue.toString();
};
- node.bind(name, replacementBinding, 'value');
+ _nodeOrCustom(node).bind(name, replacementBinding, 'value');
}
void _bindOrDelegate(node, name, model, String path,
@@ -537,9 +537,17 @@ void _bindOrDelegate(node, name, model, String path,
}
}
- node.bind(name, model, path);
+ _nodeOrCustom(node).bind(name, model, path);
}
+/**
+ * Gets the [node]'s custom [Element.xtag] if present, otherwise returns
+ * the node. This is used so nodes can override [Node.bind], [Node.unbind],
+ * and [Node.unbindAll] like InputElement does.
+ */
+// TODO(jmesserly): remove this when we can extend Element for real.
+_nodeOrCustom(node) => node is Element ? node.xtag : node;
+
class _BindingToken {
final String value;
final bool isBinding;
@@ -599,7 +607,7 @@ void _addTemplateInstanceRecord(fragment, model) {
}
void _removeAllBindingsRecursively(Node node) {
- node.unbindAll();
+ _nodeOrCustom(node).unbindAll();
for (var c = node.$dom_firstChild; c != null; c = c.nextNode) {
_removeAllBindingsRecursively(c);
}
« no previous file with comments | « tests/html/custom_element_bindings_test.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698