Commit Graph

1465 Commits

Author SHA1 Message Date
Justin Ridgewell
6796ca06c5 Comment eventsApi refactor 2015-01-27 00:43:13 -05:00
Justin Ridgewell
c73a3c33b2 Inline onceWrapper 2015-01-26 23:28:10 -05:00
Justin Ridgewell
c9e60d17df Rework addUnderscoreMethods
Removes the dependency on underscore's method lengths.
2015-01-25 18:01:59 -05:00
Graeme Yeates
7d64674561 Optimize underscore proxy methods 2015-01-25 18:01:59 -05:00
Justin Ridgewell
9abb4ab700 Trigger with object behaves dumbly
If you trigger with an object, it's prop value is prepended onto the
listener's arguments.
2015-01-25 13:31:48 -05:00
Justin Ridgewell
50adef3c03 Refactor the eventsApi
http://jsperf.com/eventsapi-refactor
2015-01-25 03:57:00 -05:00
Justin Ridgewell
d7b7a9c07d Use faster listeningTo iteration 2015-01-24 14:56:51 -05:00
Justin Ridgewell
1cb600ec54 Simplify #stopListening 2015-01-24 14:56:51 -05:00
Justin Ridgewell
0c200ca31f Delete events hash if there are none. 2015-01-24 14:56:10 -05:00
Justin Ridgewell
85fb8c30de Fix listenTo memory leak
Fixes https://github.com/jashkenas/backbone/issues/3453
2015-01-24 14:56:10 -05:00
Justin Ridgewell
c48cf5f22e Do not alter the "on" events array 2015-01-24 14:44:17 -05:00
Justin Ridgewell
85885130a8 Ensure listenToOnce without a callback noops
This mirrors the test directly above, ensuring `#once` without a
callback noops.
2015-01-23 14:08:21 -05:00
Brad Dunbar
1b0c67bdf8 Collection#set - options.at accepts a string.
Closes #3353.
2015-01-23 06:33:15 -05:00
Brad Dunbar
d550b8b852 Leave out unnecessary trailing slash. 2015-01-22 17:39:14 -05:00
Brad Dunbar
d65fd245cf Add a comment about iframe history. 2015-01-22 17:38:12 -05:00
Brad Dunbar
407705f4f8 Ensure iframe hash is set. 2015-01-22 17:38:12 -05:00
James Hartig
8569f8985c Collection.add accepts negative indexes for the at option 2015-01-22 17:38:12 -05:00
Adam Krebs
620639a819 Cleanup redundant variables in sort 2015-01-22 17:38:12 -05:00
James Hartig
545a12ec8e Order should trigger a sort iff order was changed 2015-01-22 17:38:12 -05:00
Graeme Yeates
0ca71a150d Return the result of listenTo in listenToOnce 2015-01-22 17:38:11 -05:00
Justin Ridgewell
33f814a3f9 Off wrapping callback, not the original 2015-01-22 17:38:11 -05:00
Justin Ridgewell
9c297ed609 Test that listenToOnce is only called once 2015-01-22 17:38:11 -05:00
Adam Krebs
2b6cf704e4 remove double event binding. Simply stashing the original callback works as intended 2015-01-22 17:38:11 -05:00
Adam Krebs
9c8fd8c417 move listenTo and listenToOnce in with the rest of the Backbone Events code 2015-01-22 17:38:11 -05:00
Justin Ridgewell
55749e82d9 Invert the for loop 2015-01-22 17:38:10 -05:00
Justin Ridgewell
07913be4d5 Clean up references on both listener and listened objects 2015-01-22 17:38:10 -05:00
Justin Ridgewell
ad0006f449 Remove duplicated context
We’re binding, no need to add a context to it.
2015-01-22 17:38:10 -05:00
Justin Ridgewell
e00dd73ff8 Register stopListening once instead of wrapping 2015-01-22 17:38:10 -05:00
Justin Ridgewell
00542f9d56 Return this from #listenTo 2015-01-22 17:38:10 -05:00
Adam Krebs
cb8cbf8949 de-duplicate some of the listenToOnce wrapCallback logic 2015-01-22 17:38:10 -05:00
Adam Krebs
d61ab4d2e9 implement listenToOnce via listenTo 2015-01-22 17:38:10 -05:00
Adam Krebs
a7587d7260 use on in all cases of listenTo 2015-01-22 17:38:10 -05:00
Adam Krebs
c942ce3705 fix listenToOnce with event maps 2015-01-22 17:38:09 -05:00
Jmeas
a7016ec1d7 Fixes listenToOnce memory leak. 2015-01-22 17:38:09 -05:00
Brad Dunbar
7ab8fead0e Don't check hash from iframe. 2015-01-22 17:38:09 -05:00
Brad Dunbar
54108048a8 Transition with search params. 2015-01-22 17:38:09 -05:00
Brad Dunbar
ded60e4e8c Update trailing slash for search params. 2015-01-22 17:38:09 -05:00
admangum
2878091da6 clone options passed to reset 2015-01-22 17:38:08 -05:00
Graeme Yeates
b93030b0d8 Use matches in .where 2015-01-22 17:38:08 -05:00
Brian Iversen
cd15abfd43 Update backbone.js comment for clarity
Fixed comment in backbone.js
2015-01-22 17:38:08 -05:00
JD Isaacks
325a50f2bb Allow Collection.at to accept negative indexes
This allows you to do things like

```javascript
mycollection.at(-2) // get second to last, etc.
```
2015-01-22 17:38:07 -05:00
Brad Dunbar
f6695d13fe Fix #3448. Ensure listenToOnce splits event names.
Calling `listenToOnce('x y', …)` should be functionally equivalent
to `listenToOnce('x', …); listenToOnce('y', …)`.
2015-01-19 09:42:11 -05:00
Justin Ridgewell
e58e6f0e41 Fix issue with atRoot matching.
This is to support legacy:

When an app is served at `/root`, but registers its root as `/root/`, we
should still consider the current location as the root when
transitioning from a pushState enabled browser to a hashChange browser.
2015-01-12 18:38:20 -05:00
Justin Ridgewell
de657282f5 Simplify root normalization 2015-01-12 17:29:04 -05:00
Justin Ridgewell
077dbf0a5e Use _usePushState to determine "wants" and "has" 2015-01-12 15:30:19 -05:00
Justin Ridgewell
ab304871d7 Simplify History.root 2015-01-12 15:22:32 -05:00
Brad Dunbar
faea842b89 Elaborate on History#decodeFragment. 2015-01-05 11:24:24 -05:00
Brad Dunbar
7ed58e4d39 Decode unicode escapes without decoding %25.
Fixes #3426.
2015-01-04 11:09:59 -05:00
Justin Ridgewell
c2b2a71c29 Call the success callback with context
Fixes https://github.com/jashkenas/backbone/issues/3283.
2014-12-22 12:01:28 -05:00
Adam Krebs
29244e4175 Merge pull request #3307 from gf3/model-matches
Add `Model::matches` as special-cased proxy to `_.matches`
2014-12-15 12:15:33 -05:00