| Index: pkg/template_binding/lib/src/node.dart
|
| diff --git a/pkg/template_binding/lib/src/node.dart b/pkg/template_binding/lib/src/node.dart
|
| index c4bb5f3a49337f353e47d51cd3cf35e4bd5ae781..9df36d0bcc2c6c2b636bf1addae4e492f5000670 100644
|
| --- a/pkg/template_binding/lib/src/node.dart
|
| +++ b/pkg/template_binding/lib/src/node.dart
|
| @@ -26,7 +26,7 @@ class NodeBindExtension {
|
| var b = _js['bindings_'];
|
| if (b == null) return null;
|
| // TODO(jmesserly): should cache this for identity.
|
| - return new _NodeBindingsMap(b);
|
| + return new _NodeBindingsMap(_node, b);
|
| }
|
|
|
| set bindings(Map<String, Bindable> value) {
|
| @@ -48,7 +48,7 @@ class NodeBindExtension {
|
| * Returns the [Bindable] instance.
|
| */
|
| Bindable bind(String name, value, {bool oneTime: false}) {
|
| - name = _dartToJsName(name);
|
| + name = _dartToJsName(_node, name);
|
|
|
| if (!oneTime && value is Bindable) {
|
| value = bindableToJsObject(value);
|
| @@ -73,23 +73,25 @@ class NodeBindExtension {
|
| }
|
|
|
| class _NodeBindingsMap extends MapBase<String, Bindable> {
|
| + final Node _node;
|
| final JsObject _bindings;
|
|
|
| - _NodeBindingsMap(this._bindings);
|
| + _NodeBindingsMap(this._node, this._bindings);
|
|
|
| // TODO(jmesserly): this should be lazy
|
| Iterable<String> get keys =>
|
| - js.context['Object'].callMethod('keys', [_bindings]).map(_jsToDartName);
|
| + js.context['Object'].callMethod('keys', [_bindings]).map(
|
| + (name) => _jsToDartName(_node, name));
|
|
|
| Bindable operator[](String name) =>
|
| - jsObjectToBindable(_bindings[_dartToJsName(name)]);
|
| + jsObjectToBindable(_bindings[_dartToJsName(_node, name)]);
|
|
|
| operator[]=(String name, Bindable value) {
|
| - _bindings[_dartToJsName(name)] = bindableToJsObject(value);
|
| + _bindings[_dartToJsName(_node, name)] = bindableToJsObject(value);
|
| }
|
|
|
| @override Bindable remove(String name) {
|
| - name = _dartToJsName(name);
|
| + name = _dartToJsName(_node, name);
|
| var old = this[name];
|
| _bindings.deleteProperty(name);
|
| return old;
|
| @@ -108,14 +110,14 @@ class _NodeBindingsMap extends MapBase<String, Bindable> {
|
| // called on Text nodes, which is unlikely to be used except by TemplateBinding.
|
| // Seems like a lot of magic to support it. I don't think Node.bind promises any
|
| // strong relationship between properties and [name], so textContent seems fine.
|
| -String _dartToJsName(String name) {
|
| - if (name == 'text') name = 'textContent';
|
| +String _dartToJsName(Node node, String name) {
|
| + if (node is Text && name == 'text') name = 'textContent';
|
| return name;
|
| }
|
|
|
|
|
| -String _jsToDartName(String name) {
|
| - if (name == 'textContent') name = 'text';
|
| +String _jsToDartName(Node node, String name) {
|
| + if (node is Text && name == 'textContent') name = 'text';
|
| return name;
|
| }
|
|
|
|
|