Commit Graph

244 Commits

Author SHA1 Message Date
Brad Dunbar
2a6624cb24 use _.has for Object proto props 2012-01-30 05:52:47 -05:00
Brad Dunbar
2f654d2676 cache changed attributes 2012-01-30 05:00:41 -05:00
Brad Dunbar
0d6e5f3934 Fire 'change:attr' from change 2012-01-27 14:07:33 -05:00
Jeremy Ashkenas
ab164c450d Overhauling 'validate' -- Receives the computed new state of the attrs, not just the delta. Now runs on model create, raising an exception if you try to 'new' and invalid model ... also runs even if changed silently. 2012-01-23 18:16:20 -05:00
Jeremy Ashkenas
96a7274cf7 Fixes #538 -- adds Backbone.history.stop() for unit testers. 2012-01-23 10:31:53 -05:00
Jeremy Ashkenas
36fde545f9 Merge pull request #872 from vovik/master
fixed typo in test for (presumably) equality
2012-01-22 10:04:57 -08:00
Brad Dunbar
3a891854e8 setting undefined attributes
* undefined attrs should still be set
* unset triggers change for undefined attrs
* values are set regardless of change/equality
2012-01-20 11:02:46 -05:00
vlad
c7c7b3c1a1 fixed typo in test for (presumably) equality 2012-01-18 13:49:09 -08:00
Brad Dunbar
b05deb5fb5 fix #871 - calling set with 'attributes' property 2012-01-18 12:45:09 -05:00
Jeremy Ashkenas
910ca3c190 Merge pull request #866 from braddunbar/add-tweaks
Collection#add tweaks
2012-01-17 22:50:17 -08:00
Brad Dunbar
09ab8cb17d Collection#add tweaks
* leave collection in a consistent state after throw
* correct indices
2012-01-17 23:53:02 -05:00
Brad Dunbar
397d11e340 equals is deprecated; use equal instead
http://docs.jquery.com/QUnit/equal#actualexpectedmessage
2012-01-17 23:52:12 -05:00
Jeremy Ashkenas
cea56e523a Fixes #563. Initial draft of 'wait: true' for pessimistic instead of optimistic save() create() and destroy(). Makes it easier to have your asynchronous UI and eat it too. 2012-01-17 15:26:26 -05:00
Jeremy Ashkenas
0dedb05093 Merge pull request #862 from braddunbar/implicit-callback
Router: Use implicit callback if none provided
2012-01-17 11:02:32 -08:00
Jeremy Ashkenas
1c053d9f71 Fixes #567 ... Adds a view. for the jQuery cached reference to a view's element ... and this.setElement() as a way to easily change it, redelegating events. 2012-01-17 13:54:42 -05:00
Brad Dunbar
57ef21839b use implicit callback if none provided 2012-01-17 12:12:20 -05:00
Jeremy Ashkenas
42d321f236 Fixes #570, supports Model#save(key, value) 2012-01-17 11:55:15 -05:00
Jeremy Ashkenas
09110a6656 removing erroneous console.log 2012-01-17 11:18:17 -05:00
Jeremy Ashkenas
2d02a3cfb6 Fixes #861, better error message for adding invalid models to a collection. 2012-01-17 10:54:03 -05:00
Jeremy Ashkenas
7ba0275613 Fixes #574, clone 'models' before removing, so as to allow collection.remove(collection.models) 2012-01-17 10:29:01 -05:00
Brad Dunbar
9df6387d9e trigger all for each event 2012-01-13 18:58:11 -05:00
Jeremy Ashkenas
2dce413247 Adding options.index to Collection#add and #remove. 2012-01-13 17:20:15 -05:00
Jeremy Ashkenas
34e0f7fb26 Fixes #582, fixes #425, run a second loop to trigger change:attribute events after all changes have been made. 2012-01-13 17:08:48 -05:00
Jeremy Ashkenas
4316b04ffa allow the passing of any number of arguments to Model#initialize 2012-01-13 16:10:14 -05:00
Jeremy Ashkenas
5aa4fda9ba Fixes #640 -- adds the ability to bind/unbind/trigger (on/off/trigger) multiple, space separated events, after jQuery. 2012-01-13 16:01:59 -05:00
Jeremy Ashkenas
51335bf10f Fixes #641 -- on and off are now the preferred names for bind and unbind, following jQuery. 2012-01-13 15:27:57 -05:00
Jeremy Ashkenas
5b43cd9dd1 Fixes #419 -- add a global 'route' event, on Bacckbone.history. 2012-01-13 13:47:55 -05:00
Jeremy Ashkenas
a8bd142b64 Fixes #714, assign model.collection early, so that those overriding set() can use it from the get-go. 2012-01-13 13:19:28 -05:00
Brad Dunbar
47e1f7e6c8 (un)bind does not alter callback list during trigger 2012-01-13 08:24:47 -05:00
Jeremy Ashkenas
d5ff5e32f6 Fixes #786 (and others) -- leading slashes should never be defined as routes, or passed to navigate ... so strip 'em out proactively. 2012-01-12 18:10:41 -05:00
Jeremy Ashkenas
a49bb4f3e1 Fixes #811 -- allow you to pass a context when unbinding events as well. 2012-01-12 17:09:15 -05:00
Jeremy Ashkenas
93cb997fc3 removing overzealous events setting API. 2012-01-12 16:37:18 -05:00
Jeremy Ashkenas
feefb1c352 Merge pull request #815 from zowens/master
View Event Callbacks as Functions
2012-01-12 13:34:55 -08:00
Jeremy Ashkenas
4719659298 Fixes #841, adding upgrading jquery, classname --> class in the docs. 2012-01-12 15:26:46 -05:00
Jeremy Ashkenas
1d90bb9cfc binding the comparator function before using it, so that you can rely on properties of your collection within it. 2012-01-12 15:13:22 -05:00
Jeremy Ashkenas
8cfb243b8e Fixes #836, Fixes #708 -- going back to previous stance: two models with the same id can't be added to the same collection. 2012-01-11 17:03:30 -05:00
Jeremy Ashkenas
cb7090db77 fixes #838 -- allow View#attributes to be defined as a function, as well as a value. 2012-01-11 16:47:50 -05:00
Jeremy Ashkenas
bf1ffbeb67 nice refactor. removed _add and _remove and moved 'em in to the public API. 2012-01-11 13:45:16 -05:00
Jeremy Ashkenas
eb868b66c8 merging in #846 2012-01-11 12:28:38 -05:00
Jeremy Ashkenas
2312b9072c adding a test to ensure that routes aren't triggered multiple times. #849 2012-01-11 12:11:10 -05:00
Brad Dunbar
c8919c4b05 collection.add should not alter models array 2012-01-10 17:18:11 -05:00
Zack Owens
b081fe87a5 view events can now be a function that returns an events object 2012-01-07 10:17:57 -05:00
Jeremy Ashkenas
1715c181ad Fixes #81 -- optimize for addition of large arrays of models, not for individual inserts. 2012-01-06 15:42:43 -05:00
Jeremy Ashkenas
6b3ff7b035 Fixes #9, Backbone comparators can now be either sort() or sortBy() iterators. 2012-01-06 14:53:43 -05:00
Jeremy Ashkenas
060da2b991 Merge pull request #842 from braddunbar/hasChanged-comparison
hasChanged/set should use the same comparison
2012-01-06 06:58:55 -08:00
Brad Dunbar
934aba4c6e hasChanged/set should use the same comparison
When setting a value, if hasChanged and set disagree
about equality then hasChanged will return true without
firing a 'changed:*' event (or vice versa).  Using the
same comparison (_.isEqual) solves this problem.
2012-01-06 09:19:23 -05:00
Jeremy Ashkenas
061fd3ba4f Merge pull request #809 from islandr/master
Allow Model.urlRoot to be a function
2011-12-25 22:46:12 -08:00
Zack Owens
1c158747a0 allowing view events to be functions instead of simply names of properties on a view 2011-12-25 00:03:56 -05:00
=
b4e650b98f A model's urlRoot can now be a function allowing definition at runtime. 2011-12-22 15:23:12 -10:00
Irene Ros
9d145abfe8 Forcing quint test execution order. 2011-12-22 12:23:50 -05:00