This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch introduces the first cut at one-time bindings. The syntax uses double-brackets as insertion syntax ('[[ foo ]]'). Note that this patch also changes the follow pre-existing semantics: 1) Prior to this patch, it was tolerated for the delegateFn returned by prepareBinding to decline to return an observable. This is no longer the case. It is now required that if prepareBinding return a fn, that the fn return the correct value type for the given binding type (dynamic vs. one time). 2) This patch fixes two bugs in template repeat semantics: a) It is only neccesary to observe the iteratedValue if the value can in as an Array from the repeat directive. b) Previously mutating the observed array and them immediately replacing it with another array may have resulted in errors, as the code assumed that when the iteratedValue was changed, present state of iteratedValue properly reflected the existing instances. Now the code keeps an internal array which represents the fully-synchronized state of the instances and should never be confusable. Note: I'm aware the code which sets up the TemplateIterator with repeat/bind/if values/observed values is a mess. I'm currently taking this as an indication of a problem with the design -- which I plan to fix as a follow-on. The root problem is that templates are currently set in motion via two different public API channels: template.model and template.bind(). I think template needs to just come to terms with being different -- it should only be set in motion with template.model. [email protected], arv BUG= Review URL: https://codereview.appspot.com/38540047
- Loading branch information