Chromium Code Reviews| 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); |
| } |