Permalink
...
Comparing changes
Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
jashkenas/backbone
Avalon/backbone
Backcountry/backbone
HTML5-Spain/backbone
JasonGiedymin/backbone
JesseQin/backbone
Nerian/backbone-Spark
RodH257/backbone
Rosencrantz/backbone
ScxFiction/backbone
Smarsh/backbone
SponsorPay/backbone
StevenBlack/backbone
SumitMunot/backbone
Whoaa512/backbone-livescript
ZeeAgency/backbone
addyosmani/backbone
afeld/backbone
aflatter/backbone
airhorns/backbone
aitorciki/backbone
aixeiger/backbone
alexgenovese/backbone
amdjs/backbone
antoniogarrote/backbone
asan/backbone
autohaus24/backbone
azethoth/backbone
bROthersRockers/backbone
balwantk/backbone
benchow/backbone
bfirsh/backbone
bgrins/backbone
boazsender/backbone
braddunbar/backbone
bsingr/backbone
campfirelabs/backbone
cawinkelmann/backbone
centraldesktop/backbone
charles-cai/backbone
chetan51/backbone
chrismgrant/backbone
cmonty/backbone
code-ninja/backbone
collin/backbone
corbanbrook/backbone
cureatr/backbone
dalyons/backbone
danigb/backbone
danmascena/backbone
datapimp/backbone
dcneiner/backbone
deleteme/backbone
derickbailey/backbone
devilankur18/backbone
devinhunt/backbone
djadriano/backbone
djia/backbone
djmitche/backbone
doomhz/backbone
dperrymorrow/backbone
dreverri/backbone
drewlesueur/backbone
dshaw/backbone
durdn/backbone
ecocity/backbone
ef4/backbone
enki/backbone
epall/backbone
erawk/backbone
excellentdrums/backbone
extelligence/backbone
fabrik42/backbone
ferbs/backbone
fernandogmar/backbone
fitzgen/backbone
fmaulanaa/backbone
fr1n63/backbone
fractastical/backbone
frankk00/backbone
g6scheme/backbone
gaboom/backbone
garza/backbone
gaustin/backbone-mootools
geddski/backbone
getbpm/backbone
gfranko/backbone
gmccreight/backbone
gsamokovarov/backbone
habuma/backbone
halfbaked/backbone
haoranw/backbone
hlissnake/backbone
hokaccha/backbone
hshoff/backbone
hugohua/backbone
hunterloftis/backbone
ian7/backbone
ianstormtaylor/backbone
jamesyu/backbone
janmonschke/backbone
japetheape/backbone
jcoglan/backbone
jduff/backbone
jentanbernardus/backbone
jeromegn/backbone
jhollingworth/backbone
jhuckabee/backbone
jimmytang/backbone
jo/backbone
jordandobson/backbone
jordanfowler/backbone
jroes/backbone
jstrimpel/backbone
jtescher/backbone
juggy/backbone
keithamus/backbone
krunkosaurus/backbone
kurtharriger/backbone
leeight/backbone
lmorchard/backbone
lmp/backbone
loginx/backbone
lorensr/backbone
luca/backbone
lucianlature/backbone
maccman/backbone
mataspetrikas/backbone
maw/backbone
mbriggs/backbone
mikerice/backbone
mohamedmansour/backbone
morganrallen/backbone
mostly-magic/backbone
n4niks/backbone
nanqiu/backbone
nealstewart/backbone
netmau5/backbone
nguyennamtien/backbone
nibblebot/backbone
nickjs/backbone
nikgraf/backbone
nsb/backbone
olleolleolle/backbone
omnifroodle/backbone
onycloud/backbone
pbombo/backbone-mootools
phamann/backbone
pirelenito/backbone
pkananen/backbone
r00k/backbone
raysrashmi/backbone
reconbot/backbone
rsandor/backbone
rsim/backbone
saimonmoore/backbone
scottopherson/backbone
shalstvedt/backbone
shehuaqigai/backbone
shiftb/backbone
sitron/backbone
solutionio/backbone
sstephenson/backbone
steel/backbone
stephank/backbone
strax/backbone
swalke16/backbone
tapichu/backbone
tauren/backbone
taybenlor/backbone-on-coffee
tbranyen/backbone
tessekkur/backbone
thisduck/backbone
timesselens/backbone
timheap/mootools-backbone
timruffles/backbone
tlray/backbone
toastdriven/backbone
tobie/backbone
tobowers/backbone
tomasztunik/backbone
tomokane/backbone
tonydewan/backbone
tosh/backbone
trcarden/backbone
tzuryby/backbone
ulmus/backbone
vincentbriglia/backbone
vsaar/backbone
wallin/backbone
walmartlabs/backbone
webmat/backbone
webspinner/backbone
wesen/backbone
willmoffat/backbone
wowsoso/backbone
wuzhe/backbone
zackchandler/backbone
zhj3618/backbone
zzurang/backbone
Nothing to show
Choose a Head Repository
jashkenas/backbone
Avalon/backbone
Backcountry/backbone
HTML5-Spain/backbone
JasonGiedymin/backbone
JesseQin/backbone
Nerian/backbone-Spark
RodH257/backbone
Rosencrantz/backbone
ScxFiction/backbone
Smarsh/backbone
SponsorPay/backbone
StevenBlack/backbone
SumitMunot/backbone
Whoaa512/backbone-livescript
ZeeAgency/backbone
addyosmani/backbone
afeld/backbone
aflatter/backbone
airhorns/backbone
aitorciki/backbone
aixeiger/backbone
alexgenovese/backbone
amdjs/backbone
antoniogarrote/backbone
asan/backbone
autohaus24/backbone
azethoth/backbone
bROthersRockers/backbone
balwantk/backbone
benchow/backbone
bfirsh/backbone
bgrins/backbone
boazsender/backbone
braddunbar/backbone
bsingr/backbone
campfirelabs/backbone
cawinkelmann/backbone
centraldesktop/backbone
charles-cai/backbone
chetan51/backbone
chrismgrant/backbone
cmonty/backbone
code-ninja/backbone
collin/backbone
corbanbrook/backbone
cureatr/backbone
dalyons/backbone
danigb/backbone
danmascena/backbone
datapimp/backbone
dcneiner/backbone
deleteme/backbone
derickbailey/backbone
devilankur18/backbone
devinhunt/backbone
djadriano/backbone
djia/backbone
djmitche/backbone
doomhz/backbone
dperrymorrow/backbone
dreverri/backbone
drewlesueur/backbone
dshaw/backbone
durdn/backbone
ecocity/backbone
ef4/backbone
enki/backbone
epall/backbone
erawk/backbone
excellentdrums/backbone
extelligence/backbone
fabrik42/backbone
ferbs/backbone
fernandogmar/backbone
fitzgen/backbone
fmaulanaa/backbone
fr1n63/backbone
fractastical/backbone
frankk00/backbone
g6scheme/backbone
gaboom/backbone
garza/backbone
gaustin/backbone-mootools
geddski/backbone
getbpm/backbone
gfranko/backbone
gmccreight/backbone
gsamokovarov/backbone
habuma/backbone
halfbaked/backbone
haoranw/backbone
hlissnake/backbone
hokaccha/backbone
hshoff/backbone
hugohua/backbone
hunterloftis/backbone
ian7/backbone
ianstormtaylor/backbone
jamesyu/backbone
janmonschke/backbone
japetheape/backbone
jcoglan/backbone
jduff/backbone
jentanbernardus/backbone
jeromegn/backbone
jhollingworth/backbone
jhuckabee/backbone
jimmytang/backbone
jo/backbone
jordandobson/backbone
jordanfowler/backbone
jroes/backbone
jstrimpel/backbone
jtescher/backbone
juggy/backbone
keithamus/backbone
krunkosaurus/backbone
kurtharriger/backbone
leeight/backbone
lmorchard/backbone
lmp/backbone
loginx/backbone
lorensr/backbone
luca/backbone
lucianlature/backbone
maccman/backbone
mataspetrikas/backbone
maw/backbone
mbriggs/backbone
mikerice/backbone
mohamedmansour/backbone
morganrallen/backbone
mostly-magic/backbone
n4niks/backbone
nanqiu/backbone
nealstewart/backbone
netmau5/backbone
nguyennamtien/backbone
nibblebot/backbone
nickjs/backbone
nikgraf/backbone
nsb/backbone
olleolleolle/backbone
omnifroodle/backbone
onycloud/backbone
pbombo/backbone-mootools
phamann/backbone
pirelenito/backbone
pkananen/backbone
r00k/backbone
raysrashmi/backbone
reconbot/backbone
rsandor/backbone
rsim/backbone
saimonmoore/backbone
scottopherson/backbone
shalstvedt/backbone
shehuaqigai/backbone
shiftb/backbone
sitron/backbone
solutionio/backbone
sstephenson/backbone
steel/backbone
stephank/backbone
strax/backbone
swalke16/backbone
tapichu/backbone
tauren/backbone
taybenlor/backbone-on-coffee
tbranyen/backbone
tessekkur/backbone
thisduck/backbone
timesselens/backbone
timheap/mootools-backbone
timruffles/backbone
tlray/backbone
toastdriven/backbone
tobie/backbone
tobowers/backbone
tomasztunik/backbone
tomokane/backbone
tonydewan/backbone
tosh/backbone
trcarden/backbone
tzuryby/backbone
ulmus/backbone
vincentbriglia/backbone
vsaar/backbone
wallin/backbone
walmartlabs/backbone
webmat/backbone
webspinner/backbone
wesen/backbone
willmoffat/backbone
wowsoso/backbone
wuzhe/backbone
zackchandler/backbone
zhj3618/backbone
zzurang/backbone
Nothing to show
10
contributors
Commits on May 13, 2015
|
|
jashkenas |
s/updated/update
|
e69efe7
|
|||
|
|
jashkenas |
updating sizes and dates
|
1bde5c5
|
|||
|
|
jashkenas |
mo docs
|
2b628d5
|
Commits on May 14, 2015
|
|
jridgewell |
Juggle context param with event maps
When using event maps, it's a little nicer to specify the `context`
parameter as the second argument. This keeps backwards compatibility,
though the feature wasn't documented.
```javascript
obj.on({
a: method,
b: other
}, context);
```
When you explicitly pass a `context`, we don't override.
```javascript
obj.on({
a: function() { ok(this === context); },
}, otherContext, context);
``` |
6ecee63
|
|||
|
|
megawac |
Update documented underscore dependency
|
dfd2e5b
|
|||
|
|
craigmichaelmartin |
Update index.html
|
45e8e55
|
|||
|
|
akre54 |
Merge pull request #3604 from craigmichaelmartin/href-fix
Update index.html |
22b92bf
|
|||
|
|
jridgewell |
s/updated/update/ event
|
18fdc4c
|
Commits on May 15, 2015
|
|
akre54 |
document Model#matches
|
c693340
|
|||
|
|
akre54 |
Document Collection#modelId
|
bbb43a9
|
|||
|
|
akre54 |
fix spacing in index.html page, manually merge #3606
|
47932de
|
Commits on May 16, 2015
|
|
jridgewell |
Collection#invoke should collect arguments
Fixes #3610. |
dba0faa
|
|||
|
|
megawac |
Merge pull request #3612 from jridgewell/collection-invoke
Collection#invoke should collect arguments |
f430fa0
|
|||
|
|
ahumphreys87 |
fix opening and closing iframe doc for jsdom
|
4cf2274
|
Commits on May 21, 2015
|
|
ahumphreys87 |
use local iframe window to open/close
|
dced7c8
|
Commits on May 23, 2015
Commits on May 24, 2015
Commits on May 26, 2015
|
|
jashkenas |
Merge pull request #3627 from jridgewell/model-set-style
Model#set style |
e78e9a2
|
|||
|
|
jashkenas |
Merge pull request #3630 from jridgewell/test-view
Test View |
17adb0b
|
|||
|
|
jashkenas |
Merge pull request #3629 from jridgewell/model-save-style
Model#save style |
751d6b1
|
|||
|
|
jashkenas |
Merge pull request #3628 from jridgewell/model-fetch-style
Model#fetch parse option |
165034b
|
|||
|
|
jridgewell |
Merge pull request #3609 from akre54/modelid-docs
Document Collection#modelId |
7bf2d68
|
Commits on May 27, 2015
|
|
jridgewell |
Return removed models from #_removeModels
|
46c9064
|
|||
|
|
jridgewell |
Collection#remove returns removed model
|
a910bac
|
|||
|
|
jridgewell |
Test that Collection#remove _only_ returns removed models
Add (currently) failing tests for #3512. |
61e7650
|
|||
|
|
jridgewell |
#_removeReference now removes references
|
e926394
|
|||
|
|
jashkenas |
Merge pull request #3637 from jridgewell/collection-removeModels
Return removed models from #_removeModels |
2e46597
|
|||
|
|
jridgewell |
Fix syntax error.
|
196cee7
|
|||
|
|
megawac |
Merge pull request #3639 from jridgewell/collection-removeModels
Fix syntax error |
dbcfc15
|
|||
|
|
akre54 |
correct "polymorphic" typo
|
cc25815
|
|||
|
|
akre54 |
Document delegateEvents change from #3060
|
1521570
|
|||
|
|
jashkenas |
Merge pull request #3640 from akre54/document-delegate-change
Document delegateEvents change from #3060 |
d1a459a
|
Commits on May 28, 2015
|
|
akre54 |
typo: elements -> events
|
2195406
|
Commits on May 30, 2015
|
|
jridgewell |
Collection#set shouldn't parse
|
415c3a7
|
|||
|
|
jridgewell |
Ensure fetch'd data is only parsed once
|
13de636
|
Commits on May 31, 2015
|
|
jridgewell |
Variable cleanup
|
1a8ed2e
|
|||
|
|
megawac |
Merge pull request #3645 from jridgewell/variable-cleanup
Variable cleanup |
6518a4c
|
|||
|
|
jridgewell |
Remove unnecessary assignment
|
53a4e70
|
Commits on Jun 01, 2015
|
|
jridgewell |
Merge pull request #3603 from jridgewell/event-map-context
Juggle context param with event maps |
a41a205
|
|||
|
|
jridgewell |
Merge pull request #3647 from jridgewell/collection-removeModels
Remove unnecessary assignment |
cac05d4
|
|||
|
|
akre54 |
Move addUnderscoreMethods out of Backbone.Events, adjust comment now …
…that array methods is only 1 method |
565b2a1
|
|||
|
|
akre54 |
fix typo in once comment
|
9be4131
|
|||
|
|
jridgewell |
Merge pull request #3655 from akre54/code-reorg
Code reorg |
80ef9d5
|
|||
|
|
sroucheray |
Delete `main` property duplication
|
591ab69
|
|||
|
|
braddunbar |
Merge pull request #3656 from sroucheray/patch-1
Delete `main` property duplication |
46ec991
|
Commits on Jun 02, 2015
|
|
jridgewell |
Merge pull request #3613 from ahumphreys87/jsdomRouter
Fix opening and closing iframe document in jsdom |
1c6b763
|
|||
|
|
jridgewell |
Fix failing IE6 test
It was a false positive. Our “location” parsing uses an A tag, which doesn’t always work the way the real location parsing does. |
f79e0bc
|
|||
|
|
braddunbar |
Merge pull request #3657 from jridgewell/ie6-test-false-positive
Fix failing IE6 test |
5ea1585
|
|||
|
|
jashkenas |
Merge pull request #3644 from jridgewell/collection-parse
Collection parse |
ff57b54
|
|||
|
|
jridgewell |
Revert "Merge pull request #3644 from jridgewell/collection-parse"
|
c95d977
|
|||
|
|
w0rm + jridgewell |
Added failing test case
|
ffa4fa5
|
|||
|
|
jridgewell |
Collection#add shouldn't parse a model instance
Fixes #3636, but in a backwards compatible way. |
fdea29d
|
Commits on Jun 04, 2015
|
|
jridgewell |
Ungolf #create assignment
|
6215000
|
|||
|
|
akre54 |
Merge pull request #3665 from jridgewell/collection-style-updates-2
Small Collection style updates |
41ee3b7
|
|||
|
|
paulfalgout |
Draft changelog for Backbone 1.2.1
|
2bfc84d
|
|||
|
|
jashkenas |
Merge pull request #3661 from paulfalgout/changelog-1.2.1
Draft changelog for Backbone 1.2.1 |
4148f54
|
|||
|
|
jashkenas |
Backbone 1.2.1
|
938a8ff
|
Unified
Split
Showing
with
762 additions
and 605 deletions.
- +1 −1 backbone-min.js
- +1 −1 backbone-min.map
- +121 −116 backbone.js
- +1 −1 bower.json
- +1 −1 component.json
- +437 −445 docs/backbone.html
- +91 −26 index.html
- +1 −2 package.json
- +37 −6 test/collection.js
- +18 −0 test/events.js
- +15 −0 test/model.js
- +1 −1 test/router.js
- +37 −5 test/view.js
View
2
backbone-min.js
Oops, something went wrong.
View
2
backbone-min.map
Oops, something went wrong.
View
237
backbone.js
Oops, something went wrong.
View
2
bower.json
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name" : "backbone", | ||
| - "version" : "1.2.0", | ||
| + "version" : "1.2.1", | ||
| "main" : "backbone.js", | ||
| "dependencies" : { | ||
| "underscore" : ">=1.7.0" | ||
View
2
component.json
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name" : "backbone", | ||
| - "version" : "1.2.0", | ||
| + "version" : "1.2.1", | ||
| "description" : "Give your JS App some Backbone with Models, Views, Collections, and Events.", | ||
| "keywords" : ["model", "view", "controller", "router", "server", "client", "browser"], | ||
| "repo" : "jashkenas/backbone", | ||
View
882
docs/backbone.html
Oops, something went wrong.
View
117
index.html
| @@ -300,7 +300,7 @@ | ||
| <div id="sidebar" class="interface"> | ||
| <a class="toc_title" href="#"> | ||
| - Backbone.js <span class="version">(1.2.0)</span> | ||
| + Backbone.js <span class="version">(1.2.1)</span> | ||
| </a> | ||
| <ul class="toc_section"> | ||
| <li>» <a href="http://github.com/jashkenas/backbone">GitHub Repository</a></li> | ||
| @@ -356,7 +356,7 @@ | ||
| <li>– <a href="#Model-fetch">fetch</a></li> | ||
| <li>– <a href="#Model-save">save</a></li> | ||
| <li>– <a href="#Model-destroy">destroy</a></li> | ||
| - <li>– <a href="#Model-Underscore-Methods"><b>Underscore Methods (8)</b></a></li> | ||
| + <li>– <a href="#Model-Underscore-Methods"><b>Underscore Methods (9)</b></a></li> | ||
| <li>– <a href="#Model-validate">validate</a></li> | ||
| <li>– <a href="#Model-validationError">validationError</a></li> | ||
| <li>– <a href="#Model-isValid">isValid</a></li> | ||
| @@ -377,6 +377,7 @@ | ||
| <ul class="toc_section"> | ||
| <li>– <a href="#Collection-extend">extend</a></li> | ||
| <li>– <a href="#Collection-model">model</a></li> | ||
| + <li>– <a href="#Collection-modelId">modelId</a></li> | ||
| <li>– <a href="#Collection-constructor">constructor / initialize</a></li> | ||
| <li>– <a href="#Collection-models">models</a></li> | ||
| <li>– <a href="#Collection-toJSON">toJSON</a></li> | ||
| @@ -577,13 +578,13 @@ <h2 id="downloads"> | ||
| <table> | ||
| <tr> | ||
| - <td><a class="punch" href="backbone.js">Development Version (1.2.0)</a></td> | ||
| - <td class="text"><i>60kb, Full source, tons of comments</i></td> | ||
| + <td><a class="punch" href="backbone.js">Development Version (1.2.1)</a></td> | ||
| + <td class="text"><i>69kb, Full source, tons of comments</i></td> | ||
| </tr> | ||
| <tr> | ||
| - <td><a class="punch" href="backbone-min.js">Production Version (1.2.0)</a></td> | ||
| + <td><a class="punch" href="backbone-min.js">Production Version (1.2.1)</a></td> | ||
| <td class="text" style="line-height: 16px;"> | ||
| - <i>6.5kb, Packed and gzipped</i><br /> | ||
| + <i>7.3kb, Packed and gzipped</i><br /> | ||
| <small>(<a href="backbone-min.map">Source Map</a>)</small> | ||
| </td> | ||
| </tr> | ||
| @@ -600,7 +601,7 @@ <h2 id="downloads"> | ||
| <p> | ||
| Backbone's only hard dependency is | ||
| - <a href="http://underscorejs.org/">Underscore.js</a> <small>( >= 1.5.0)</small>. | ||
| + <a href="http://underscorejs.org/">Underscore.js</a> <small>( >= 1.7.0)</small>. | ||
| For RESTful persistence and DOM manipulation with <a href="#View">Backbone.View</a>, | ||
| include <b><a href="http://jquery.com">jQuery</a></b> ( >= 1.11.0), and | ||
| <b><a href="https://github.com/douglascrockford/JSON-js">json2.js</a></b> for older | ||
| @@ -997,22 +998,22 @@ <h2 id="Events">Backbone.Events</h2> | ||
| </p> | ||
| <ul class="small"> | ||
| - <li><b>"add"</b> (model, collection, options) — when a model is added to a collection. </li> | ||
| - <li><b>"remove"</b> (model, collection, options) — when a model is removed from a collection. </li> | ||
| - <li><b>"update"</b> (collection, options) — single event triggered after any number of movels have been added or removed from a collection. </li> | ||
| - <li><b>"reset"</b> (collection, options) — when the collection's entire contents have been replaced. </li> | ||
| - <li><b>"sort"</b> (collection, options) — when the collection has been re-sorted. </li> | ||
| - <li><b>"change"</b> (model, options) — when a model's attributes have changed. </li> | ||
| - <li><b>"change:[attribute]"</b> (model, value, options) — when a specific attribute has been updated. </li> | ||
| - <li><b>"destroy"</b> (model, collection, options) — when a model is <a href="#Model-destroy">destroyed</a>. </li> | ||
| - <li><b>"request"</b> (model_or_collection, xhr, options) — when a model or collection has started a request to the server. </li> | ||
| + <li><b>"add"</b> (model, collection, options) — when a model is added to a collection.</li> | ||
| + <li><b>"remove"</b> (model, collection, options) — when a model is removed from a collection.</li> | ||
| + <li><b>"update"</b> (collection, options) — single event triggered after any number of models have been added or removed from a collection.</li> | ||
| + <li><b>"reset"</b> (collection, options) — when the collection's entire contents have been replaced.</li> | ||
| + <li><b>"sort"</b> (collection, options) — when the collection has been re-sorted.</li> | ||
| + <li><b>"change"</b> (model, options) — when a model's attributes have changed.</li> | ||
| + <li><b>"change:[attribute]"</b> (model, value, options) — when a specific attribute has been updated.</li> | ||
| + <li><b>"destroy"</b> (model, collection, options) — when a model is <a href="#Model-destroy">destroyed</a>.</li> | ||
| + <li><b>"request"</b> (model_or_collection, xhr, options) — when a model or collection has started a request to the server.</li> | ||
| <li><b>"sync"</b> (model_or_collection, resp, options) — when a model or collection has been successfully synced with the server.</li> | ||
| - <li><b>"error"</b> (model_or_collection, resp, options) — when a model's or collection's request to the server has failed. </li> | ||
| - <li><b>"invalid"</b> (model, error, options) — when a model's <a href="#Model-validate">validation</a> fails on the client. </li> | ||
| + <li><b>"error"</b> (model_or_collection, resp, options) — when a model's or collection's request to the server has failed.</li> | ||
| + <li><b>"invalid"</b> (model, error, options) — when a model's <a href="#Model-validate">validation</a> fails on the client.</li> | ||
| <li><b>"route:[name]"</b> (params) — Fired by the router when a specific route is matched.</li> | ||
| <li><b>"route"</b> (route, params) — Fired by the router when <i>any</i> route has been matched.</li> | ||
| <li><b>"route"</b> (router, route, params) — Fired by history when <i>any</i> route has been matched.</li> | ||
| - <li><b>"all"</b> — this special event fires for <i>any</i> triggered event, passing the event name as the first argument. </li> | ||
| + <li><b>"all"</b> — this special event fires for <i>any</i> triggered event, passing the event name as the first argument.</li> | ||
| </ul> | ||
| <p> | ||
| @@ -1470,9 +1471,9 @@ <h2 id="Model">Backbone.Model</h2> | ||
| </pre> | ||
| <p id="Model-Underscore-Methods"> | ||
| - <b class="header">Underscore Methods (8)</b> | ||
| + <b class="header">Underscore Methods (9)</b> | ||
| <br /> | ||
| - Backbone proxies to <b>Underscore.js</b> to provide 8 object functions | ||
| + Backbone proxies to <b>Underscore.js</b> to provide 9 object functions | ||
| on <b>Backbone.Model</b>. They aren't all documented here, but | ||
| you can take a look at the Underscore documentation for the full details… | ||
| </p> | ||
| @@ -1484,6 +1485,7 @@ <h2 id="Model">Backbone.Model</h2> | ||
| <li><a href="http://underscorejs.org/#invert">invert</a></li> | ||
| <li><a href="http://underscorejs.org/#pick">pick</a></li> | ||
| <li><a href="http://underscorejs.org/#omit">omit</a></li> | ||
| + <li><a href="http://underscorejs.org/#matches">matches</a></li> | ||
| <li><a href="http://underscorejs.org/#chain">chain</a></li> | ||
| <li><a href="http://underscorejs.org/#isEmpty">isEmpty</a></li> | ||
| </ul> | ||
| @@ -1771,6 +1773,36 @@ <h2 id="Collection">Backbone.Collection</h2> | ||
| }); | ||
| </pre> | ||
| + <p id="Collection-modelId"> | ||
| + <b class="header">modelId</b><code>collection.modelId</code> | ||
| + <br /> | ||
| + Override this method to specify the attribute the collection will use to | ||
| + refer to its models in <a href="#Collection-get">collection.get</a>. | ||
| + <br /> | ||
| + By default returns the <tt>idAttribute</tt> of the collection's model | ||
| + class or failing that, <tt>'id'</tt>. If your collection uses polymorphic | ||
| + models and those models have an <tt>idAttribute</tt> other than <tt>id</tt> | ||
| + you must override this method with your own custom logic. | ||
| + </p> | ||
| + | ||
| +<pre> | ||
| +var Library = Backbone.Collection.extend({ | ||
| + | ||
| + model: function(attrs, options) { | ||
| + if (condition) { | ||
| + return new PublicDocument(attrs, options); | ||
| + } else { | ||
| + return new PrivateDocument(attrs, options); | ||
| + } | ||
| + }, | ||
| + | ||
| + modelId: function(attrs) { | ||
| + return attrs.private ? 'private_id' : 'public_id'; | ||
| + } | ||
| + | ||
| +}); | ||
| +</pre> | ||
| + | ||
| <p id="Collection-constructor"> | ||
| <b class="header">constructor / initialize</b><code>new Backbone.Collection([models], [options])</code> | ||
| <br /> | ||
| @@ -1893,7 +1925,7 @@ <h2 id="Collection">Backbone.Collection</h2> | ||
| <b class="header">add</b><code>collection.add(models, [options])</code> | ||
| <br /> | ||
| Add a model (or an array of models) to the collection, firing an <tt>"add"</tt> | ||
| - event. If a <a href="#Collection-model">model</a> property is defined, you may also pass | ||
| + event for each model, and an <tt>"update"</tt> event afterwards. If a <a href="#Collection-model">model</a> property is defined, you may also pass | ||
| raw attributes objects, and have them be vivified as instances of the model. | ||
| Returns the added (or preexisting, if duplicate) models. | ||
| Pass <tt>{at: index}</tt> to splice the model into the collection at the | ||
| @@ -1928,7 +1960,8 @@ <h2 id="Collection">Backbone.Collection</h2> | ||
| them. Each model can be a Model instance, an <tt>id</tt> string or a JS | ||
| object, any value acceptable as the <tt>id</tt> argument of | ||
| <a href="#Collection-get"><tt>collection.get</tt></a>. | ||
| - Fires a <tt>"remove"</tt> event, which you can use <tt>silent</tt> to suppress. | ||
| + Fires a <tt>"remove"</tt> event for each model, and a single | ||
| + <tt>"update"</tt> event afterwards. | ||
| The model's index before removal is available to listeners as | ||
| <tt>options.index</tt>. | ||
| </p> | ||
| @@ -4204,7 +4237,34 @@ <h2 id="examples-tzigla">Tzigla</h2> | ||
| <h2 id="changelog">Change Log</h2> | ||
| - <b class="header">1.2.0</b> — <small><i>Aug. 29, 2014</i></small> | ||
| + <b class="header">1.2.1</b> — <small><i>Jun. 4, 2015</i></small> | ||
| + — <a href="https://github.com/jashkenas/backbone/compare/1.2.0...1.2.1">Diff</a> | ||
| + — <a href="https://cdn.rawgit.com/jashkenas/backbone/1.2.1/index.html">Docs</a> | ||
| + <br /> | ||
| + <ul style="margin-top: 5px;"> | ||
| + <li> | ||
| + <tt>Collection#add</tt> now avoids trying to parse a model instance when passing <tt>parse: true</tt>. | ||
| + </li> | ||
| + <li> | ||
| + Bug fix in <tt>Collection#remove</tt>. | ||
| + </li> | ||
| + <li> | ||
| + <tt>Model#fetch</tt> no longer parses the response when passing <tt>patch: false</tt>. | ||
| + </li> | ||
| + <li> | ||
| + Bug fix for iframe-based History when used with JSDOM. | ||
| + </li> | ||
| + <li> | ||
| + Bug fix where <tt>Collection#invoke</tt> was not taking additional arguments. | ||
| + </li> | ||
| + <li> | ||
| + When using <tt>on</tt> with an event map, you can now pass the context as the | ||
| + second argument. This was previously an undocumented behavior from 1.1.2 removed | ||
| + in 1.2.0. | ||
| + </li> | ||
| + </ul> | ||
| + | ||
| + <b class="header">1.2.0</b> — <small><i>May 13, 2015</i></small> | ||
| — <a href="https://github.com/jashkenas/backbone/compare/1.1.2...1.2.0">Diff</a> | ||
| — <a href="https://cdn.rawgit.com/jashkenas/backbone/1.2.0/index.html">Docs</a> | ||
| <br /> | ||
| @@ -4224,8 +4284,13 @@ <h2 id="changelog">Change Log</h2> | ||
| Backbone will automatically try to load jQuery for you. | ||
| </li> | ||
| <li> | ||
| - Added an <tt>"updated"</tt> event that triggers after any amount of | ||
| - models are added or removed from a collection. Handy to re-render lists | ||
| + Views now always delegate their events in <a href="#View-setElement">setElement</a>. | ||
| + You can no longer modify the events hash or your view's <tt>el</tt> property in | ||
| + <tt>initialize</tt>. | ||
| + </li> | ||
| + <li> | ||
| + Added an <tt>"update"</tt> event that triggers after any amount of | ||
| + models are added or removed from a collection. Handy to re-render lists | ||
| of things without debouncing. | ||
| </li> | ||
| <li> | ||
View
3
package.json
| @@ -15,15 +15,14 @@ | ||
| "karma-qunit": "^0.1.4", | ||
| "uglify-js": "^2.4.17" | ||
| }, | ||
| - "main": "backbone.js", | ||
| "scripts": { | ||
| "test": "./node_modules/karma/bin/karma start && coffee test/model.coffee", | ||
| "build": "uglifyjs backbone.js --mangle --source-map backbone-min.map -o backbone-min.js", | ||
| "doc": "docco backbone.js && docco examples/todos/todos.js examples/backbone.localStorage.js", | ||
| "lint": "jsl -nofilelisting -nologo -conf docs/jsl.conf -process backbone.js" | ||
| }, | ||
| "main" : "backbone.js", | ||
| - "version" : "1.2.0", | ||
| + "version" : "1.2.1", | ||
| "license" : "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
View
43
test/collection.js
| @@ -298,17 +298,13 @@ | ||
| deepEqual(col.pluck('id'), [1, 2, 3]); | ||
| }); | ||
| - test("remove", 7, function() { | ||
| + test("remove", 10, function() { | ||
| var removed = null; | ||
| - var otherRemoved = null; | ||
| var result = null; | ||
| col.on('remove', function(model, col, options) { | ||
| removed = model.get('label'); | ||
| equal(options.index, 3); | ||
| }); | ||
| - otherCol.on('remove', function(model, col, options) { | ||
| - otherRemoved = true; | ||
| - }); | ||
| result = col.remove(d); | ||
| equal(removed, 'd'); | ||
| strictEqual(result, d); | ||
| @@ -317,7 +313,13 @@ | ||
| strictEqual(result, undefined); | ||
| equal(col.length, 3); | ||
| equal(col.first(), a); | ||
| - equal(otherRemoved, null); | ||
| + col.off(); | ||
| + result = col.remove([c, d]); | ||
| + equal(result.length, 1, 'only returns removed models'); | ||
| + equal(result[0], c, 'only returns removed models'); | ||
| + result = col.remove([c, b]); | ||
| + equal(result.length, 1, 'only returns removed models'); | ||
| + equal(result[0], b, 'only returns removed models'); | ||
| }); | ||
| test("add and remove return values", 13, function() { | ||
| @@ -559,6 +561,20 @@ | ||
| }); | ||
| + test("create with wait:true should not call collection.parse", 0, function() { | ||
| + var Collection = Backbone.Collection.extend({ | ||
| + url: '/test', | ||
| + parse: function () { | ||
| + ok(false); | ||
| + } | ||
| + }); | ||
| + | ||
| + var collection = new Collection; | ||
| + | ||
| + collection.create({}, {wait: true}); | ||
| + this.ajaxSettings.success(); | ||
| + }); | ||
| + | ||
| test("a failing create returns model with errors", function() { | ||
| var ValidatingModel = Backbone.Model.extend({ | ||
| validate: function(attrs) { | ||
| @@ -1605,4 +1621,19 @@ | ||
| collection.set([{id: 1}, {id: 2}]); | ||
| }); | ||
| + test("#3610 - invoke collects arguments", 3, function() { | ||
| + var Model = Backbone.Model.extend({ | ||
| + method: function(a, b, c) { | ||
| + equal(a, 1); | ||
| + equal(b, 2); | ||
| + equal(c, 3); | ||
| + } | ||
| + }); | ||
| + var Collection = Backbone.Collection.extend({ | ||
| + model: Model | ||
| + }); | ||
| + var collection = new Collection([{id: 1}]); | ||
| + collection.invoke('method', 1, 2, 3); | ||
| + }); | ||
| + | ||
| })(); | ||
View
18
test/events.js
| @@ -66,6 +66,24 @@ | ||
| equal(obj.counter, 5); | ||
| }); | ||
| + test("binding and trigger with event maps context", 2, function() { | ||
| + var obj = { counter: 0 }; | ||
| + var context = {}; | ||
| + _.extend(obj, Backbone.Events); | ||
| + | ||
| + obj.on({ | ||
| + a: function() { | ||
| + strictEqual(this, context, 'defaults `context` to `callback` param'); | ||
| + } | ||
| + }, context).trigger('a'); | ||
| + | ||
| + obj.off().on({ | ||
| + a: function() { | ||
| + strictEqual(this, context, 'will not override explicit `context` param'); | ||
| + } | ||
| + }, this, context).trigger('a'); | ||
| + }); | ||
| + | ||
| test("listenTo and stopListening", 1, function() { | ||
| var a = _.extend({}, Backbone.Events); | ||
| var b = _.extend({}, Backbone.Events); | ||
View
15
test/model.js
| @@ -550,6 +550,21 @@ | ||
| model.destroy(options); | ||
| }); | ||
| + test("#3470 - save and fetch with parse false", 2, function() { | ||
| + var i = 0; | ||
| + var model = new Backbone.Model(); | ||
| + model.parse = function() { | ||
| + ok(false); | ||
| + }; | ||
| + model.sync = function(method, model, options) { | ||
| + options.success({i: ++i}); | ||
| + }; | ||
| + model.fetch({parse: false}); | ||
| + equal(model.get('i'), i); | ||
| + model.save(null, {parse: false}); | ||
| + equal(model.get('i'), i); | ||
| + }); | ||
| + | ||
| test("save with PATCH", function() { | ||
| doc.clear().set({id: 1, a: 1, b: 2, c: 3, d: 4}); | ||
| doc.save(); | ||
View
2
test/router.js
| @@ -918,7 +918,7 @@ | ||
| test('#3358 - pushState to hashChange transition with search params', 1, function() { | ||
| Backbone.history.stop(); | ||
| - location.replace('/root?foo=bar'); | ||
| + location.replace('http://example.com/root?foo=bar'); | ||
| location.replace = function(url) { | ||
| strictEqual(url, '/root#?foo=bar'); | ||
| }; | ||
Oops, something went wrong.
Showing you all comments on commits in this comparison.
|
Lol #3661 (comment) |