Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dom-repeat: Instance to item binding demo
If important instance state is not handled by property binding, using dom-repeat currently leads to unexpected behaviour when the items list is re-arranged. A good example of this is input focus which will not behave as the user expects. By optionally binding instances to items, the developer can ensure that unmanaged instance state will follow the items as the user would expect. This commit provides a domRepeat.refProp property that can be used to specify a property of the model.item object that will be used as a key/reference. E.g: ``` <dom-repeat ref-prop='key'> <template> <span>My key is:</span><span>{{item.key}}</span> </template> </dom-repeat> ``` When the domRepeat.items property changes (or the sort and filter functions change), instances that are bound to a key will be moved in the dom to match the new position of the key. Note that a bound instance will be removed as soon as a render is performed and the key is not present. This might change when the pooling policy is refined. All existing tests are passing on my local machine. No new tests have been written yet. I will wait for feedback before doing this.
- Loading branch information