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

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..0cc603d369bc0634b37be7824b31c65bc9875d12 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
+ */
+// TODO(jmesserly): remove this when we can extend Element for real.
+_nodeOrCustom(node) => node is Element ? node.xtag : node;
Siggi Cherem (dart-lang) 2013/05/13 16:42:13 interesting, what about a custom element that exte
Jennifer Messerly 2013/05/13 19:42:41 Not sure I understand... What this does is try an
Jennifer Messerly 2013/05/13 19:43:45 oops, "skill the custom impl" should be "skip the
+
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);
}

Powered by Google App Engine
This is Rietveld 408576698