Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection#add tweaks #866

Merged
merged 1 commit into from
Jan 18, 2012
Merged

Collection#add tweaks #866

merged 1 commit into from
Jan 18, 2012

Conversation

braddunbar
Copy link
Collaborator

When aborting due to invalid or duplicate models the collection should be left in a consistent state. Model events, length, _byCid, and _byId should not change.

Also, when a comparator is supplied the indices of the models are changed after the collection is sorted. Thus we must trigger 'add' with the new values. By iterating over the collection, we avoid calling indexOf for each model.

* leave collection in a consistent state after throw
* correct indices
jashkenas added a commit that referenced this pull request Jan 18, 2012
@jashkenas jashkenas merged commit 910ca3c into jashkenas:master Jan 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants