Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
dont overload binding apis for template binding
Browse files Browse the repository at this point in the history
john points out that it's weird for TemplateBinding.node to point to the template iterator.

We don't really have a clear delineation of public vs private API right now, but I agree that the iterator reference should really be private.

I'm not prepared yet to go through and start marking private members with trailing underscores. We had that for a while and it just go really ugly.

Hopefully, once we get all of our semantics nailed down, we can write the spec and the IDL and that will make it clear.

r=arv
BUG=

Review URL: https://codereview.appspot.com/12296043
  • Loading branch information
rafaelw committed Aug 1, 2013
1 parent 75e63f5 commit 32d409c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/template_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,13 +762,14 @@
ensureScheduled(setModelFn);
}

function TemplateBinding(node, property, model, path) {
function TemplateBinding(node, property, model, path, iterator) {
this.closed = false;
this.node = node;
this.property = property;
this.model = model;
this.path = path;
this.node.inputs.bind(this.property, model, path || '');
this.iterator = iterator;
this.iterator.inputs.bind(this.property, model, path || '');
}

TemplateBinding.prototype = createObject({
Expand All @@ -778,7 +779,8 @@
close: function() {
if (this.closed)
return;
this.node.inputs.unbind(this.property);
this.iterator.inputs.unbind(this.property);
this.iterator = undefined;
this.node = undefined;
this.model = undefined;
this.closed = true;
Expand All @@ -794,7 +796,7 @@
var iterator = TemplateIterator.getOrCreate(this);
this.unbind(name);
return this.bindings[name] =
new TemplateBinding(iterator, name, model, path || '');
new TemplateBinding(this, name, model, path || '', iterator);
},

createInstance: function(model, delegate, bound) {
Expand Down

0 comments on commit 32d409c

Please sign in to comment.