Commit Graph

960 Commits

Author SHA1 Message Date
Casey Foster
a3da45efd5 Backbone extends Events 2012-12-10 07:46:00 -08:00
Jeremy Ashkenas
4da25a48a6 Passing a configured version of jshint 2012-12-10 10:31:28 -05:00
Jeremy Ashkenas
a389e81e71 removing accidental globals -- need to get lint hooked up. 2012-12-10 09:59:55 -05:00
Casey Foster
bee1296053 Update update to merge cleanly 2012-12-08 17:55:15 -08:00
Casey Foster
c51b9cc5fd Rebasing update
Reuse prepared model in Collection#update

Remove extra whitespace

Trigger `update` after Collection#update unless silent

Don't create new models in Collection#update

Remove `slice` call from Collection#update

It isn't necessary since the array isn't being modified. `add` and
`remove` both slice the arrays they are passed, so simply reading
and passing on the pristine array to those functions is harmless.

Simplify excessive ternary in Collection#update

`update` supports simple add/remove/merge options

Cleanup `update`, support for any combination of add/merge/remove

Save a potentially useless `slice` in `update`

Add comments and more tests for Collection#update

Avoid splice and slice, they're too slow!
2012-12-08 17:48:55 -08:00
Jeremy Ashkenas
7dbfecc6c1 Fixes #697 -- Add 'once' to backbone events, supporting event maps, off, and all that jazz 2012-12-07 17:56:56 -05:00
Jeremy Ashkenas
62b80bfc32 Fixes #1340 -- reset events include previous list of models, for added convenience. 2012-12-07 16:20:24 -05:00
Jeremy Ashkenas
6dadc92765 Merge branch 'encoded-fragments' of https://github.com/braddunbar/backbone 2012-12-07 15:24:55 -05:00
Tim Branyen
f416c5be6d bumping the version in master, reflecting the wip state 2012-12-07 09:57:59 -05:00
Jeremy Ashkenas
23cc302a51 Fixes #1477 -- Changing Backbone's internal logic so that validation always happens, even when silent: true. Defining a validate should never allow state to become invalid, even during a silent change. 2012-12-06 16:48:29 -05:00
Jeremy Ashkenas
362b91c8e4 Fixes #1456. Enhances Backbone.Events to support jQuery-style event maps, in 'on' and 'off'. 2012-12-06 16:12:19 -05:00
Jeremy Ashkenas
8711f3c781 Fixes #1870 -- allow empty bodies for difficult endpoints. 2012-12-06 15:43:25 -05:00
Casey Foster
aefd78f949 Merge branch 'master' into collection-update
Conflicts:
	test/collection.js
2012-12-05 10:31:31 -08:00
Casey Foster
54ac6b0e4c Cleanup collection#update 2012-12-05 10:19:59 -08:00
Jeremy Ashkenas
a7be84ef37 merged. 2012-12-04 17:41:57 -05:00
Casey Foster
1b985790a4 Simplify conditional in Collection#update 2012-12-01 12:33:23 -08:00
Casey Foster
beffc15a0b Add Collection#update to better use collection events 2012-12-01 12:26:11 -08:00
Casey Foster
59850645e6 Only sort on add when it make sense 2012-11-30 15:40:01 -08:00
Tim Griesser
e5a3b0bba0 consistent 'parse' option on collection constructor & reset 2012-11-30 11:47:01 -05:00
Casey Foster
e841851d56 Fix global i leak in change 2012-11-28 23:21:51 -08:00
Jeremy Ashkenas
29dc8fc2bc initial merge of tgriesser's change cleanup 2012-11-28 17:04:27 -05:00
Jeremy Ashkenas
e27c86e8f7 indentation 2012-11-28 15:08:56 -05:00
Jeremy Ashkenas
942c19926d Merge pull request #1717 from davidgtonge/master
Stop Backbone throwing an error when an invalid model is added
2012-11-28 12:07:59 -08:00
Jeremy Ashkenas
2da7c73901 fixing the parse inconsistency in the original mmanner. 2012-11-28 14:39:59 -05:00
Jeremy Ashkenas
a0aabb405b Revert "Fixes #1843 -- reworks parsing behavior. It now always applies if you define it, and no longer passes xhr. (parsing should be a pure function of the data)"
This reverts commit fbbb2e675e.
2012-11-28 14:39:01 -05:00
Jeremy Ashkenas
fbbb2e675e Fixes #1843 -- reworks parsing behavior. It now always applies if you define it, and no longer passes xhr. (parsing should be a pure function of the data) 2012-11-28 14:26:49 -05:00
Jeremy Ashkenas
3de9f3504e Revert "tiny tweak"
This reverts commit e7d85efa9c.
2012-11-28 14:14:21 -05:00
Jeremy Ashkenas
e7d85efa9c tiny tweak 2012-11-28 14:00:06 -05:00
Adam Krebs
b34f4f38c7 use _.result for this.options 2012-11-27 10:44:01 -05:00
Adam George
be209e623d Pass options through to toJSON
This is useful if you have overriden toJSON with own implemention and
need to pass some options through
2012-11-21 14:34:15 +11:00
Al Urim
70ff93bdfc Update backbone.js
Remove unnecessary argument.
2012-11-20 12:47:53 -08:00
Jeremy Ashkenas
0b27091e5a fixes previous commit 2012-11-19 15:30:51 -05:00
Jeremy Ashkenas
c746c3c5c2 Fixes #1806, model.save(null, {wait: true}) with validation 2012-11-19 15:29:41 -05:00
Tim Griesser
a96fe08f92 allowing events to be passed in view's options 2012-11-16 14:21:59 -05:00
Brad Dunbar
39ff3870a7 Fix gh-1820 - Update comment, use global flag. 2012-11-14 17:00:17 -05:00
Brad Dunbar
b75c4c52ee Merge branch 'master' into emulate-options
Conflicts:
	backbone.js
	test/sync.js
2012-11-02 17:05:29 -04:00
Brad Dunbar
d196c25fe6 Strip trailing space from fragments. 2012-11-02 09:03:16 -04:00
Brian Erickson
8decce8d7d Issue #1793: Backbone.history.navigate should use this.getFragment instead of fragment to avoid routes getting triggered twice 2012-11-01 22:41:47 -06:00
Casey Foster
34ce37137e Fix #1791 reorder constructor so attributes is defined for parse 2012-11-01 17:02:37 -07:00
Casey Foster
33a5ea3310 Match save to new set signature 2012-10-24 21:46:35 -04:00
Casey Foster
68d1e70a4a Refactor set to avoid unnecessary arguments object creation 2012-10-24 21:22:42 -04:00
Brad Dunbar
ef8e10fafb Further simplify Router#_bindRoutes. 2012-10-24 17:59:40 -04:00
Casey Foster
dbad306684 Match save to new set signature 2012-10-23 07:44:17 -07:00
Casey Foster
f73de64c33 Refactor set to avoid unnecessary arguments object creation 2012-10-22 20:22:58 -07:00
Genadi Samokovarov
85a1e3ea5c Use _.pick to simplify View#_configure 2012-10-22 12:51:43 +03:00
Genadi Samokovarov
4e0627cbbc Update outdated comments 2012-10-22 01:37:49 +03:00
Casey Foster
dd592ad806 Be sure to return the value of beforeSend 2012-10-19 13:42:15 -07:00
Jeremy Ashkenas
203e9b9e2d Merge pull request #1757 from braddunbar/beforesend
Preserve user provided beforeSend.
2012-10-19 13:28:27 -07:00
Brad Dunbar
1d909d4fe0 Fix #1756 - preserve user provided beforeSend. 2012-10-19 16:08:40 -04:00
Michał Łowicki
817f8728a2 Call 'beforeSend' function set with $.ajaxSetup when Backbone.emulateHTTP is set to true.
Previously if we set:

  Backbone.emulateHTTP = true;

and 'beforeSend' on $.ajax via:

  $.ajaxSetup({
    beforeSend: function (xhr) {
      xhr.setRequestHeader('X-CSRFToken', $.cookie('csrftoken'));
    }
  });

Then 'beforeSend' won't be called on xhr requests.
2012-10-19 20:57:02 +02:00