8000 Update vendors. · lodash/lodash@24b672b · GitHub
[go: up one dir, main page]

Skip to content

Commit 24b672b

Browse files
committed
Update vendors.
Former-commit-id: 4ccda4fafe86514cdb45d191cb743baca9b1baa4
1 parent de6a3c5 commit 24b672b

File tree

7 files changed

+92
-44
lines changed

7 files changed

+92
-44
lines changed

vendor/backbone/backbone.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,10 @@
561561
if (options.comparator !== void 0) this.comparator = options.comparator;
562562
this._reset();
563563
this.initialize.apply(this, arguments);
564-
if (models) this.reset(models, {silent: true, parse: options.parse});
564+
if (models) {
565+
if (options.parse) models = this.parse(models);
566+
this.reset(models, {silent: true, parse: options.parse});
567+
}
565568
};
566569

567570
// Define the Collection's inheritable methods.
@@ -864,11 +867,12 @@
864867
});
865868

866869
// Underscore methods that we want to implement on the Collection.
867-
var methods = ['forEach', 'each', 'map', 'reduce', 'reduceRight', 'find',
868-
'detect', 'filter', 'select', 'reject', 'every', 'all', 'some', 'any',
869-
'include', 'contains', 'invoke', 'max', 'min', 'sortBy', 'sortedIndex',
870-
'toArray', 'size', 'first', 'initial', 'rest', 'last', 'without', 'indexOf',
871-
'shuffle', 'lastIndexOf', 'isEmpty', 'groupBy'];
870+
var methods = ['forEach', 'each', 'map', 'collect', 'reduce', 'foldl',
871+
'inject', 'reduceRight', 'foldr', 'find', 'detect', 'filter', 'select',
872+
'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke',
873+
'max', 'min', 'sortBy', 'sortedIndex', 'toArray', 'size', 'first', 'head',
874+
'take', 'initial', 'rest', 'tail', 'last', 'without', 'indexOf', 'shuffle',
875+
'lastIndexOf', 'isEmpty', 'groupBy'];
872876

873877
// Mix in each Underscore method as a proxy to `Collection#models`.
874878
_.each(methods, function(method) {
@@ -1201,9 +1205,19 @@
12011205
return this;
12021206
},
12031207

1208+
// Clean up references to this view in order to prevent latent effects and
1209+
// memory leaks.
1210+
dispose: function() {
1211+
this.undelegateEvents();
1212+
if (this.model) this.model.off(null, null, this);
1213+
if (this.collection) this.collection.off(null, null, this);
1214+
return this;
1215+
},
1216+
12041217
// Remove this view from the DOM. Note that the view isn't present in the
12051218
// DOM by default, so calling this method may be a no-op.
12061219
remove: function() {
1220+
this.dispose();
12071221
this.$el.remove();
12081222
return this;
12091223
},

vendor/backbone/test/collection.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,29 @@ $(document).ready(function() {
4747
equal(col.length, 4);
4848
});
4949

50+
test("Collection: new and parse", 3, function() {
51+
var MyCol = Backbone.Collection.extend({
52+
// only save the models that have an even value.
53+
parse : function(data) {
54+
var onlyEven = [];
55+
_.each(data, function(datum) {
56+
if (datum.a % 2 === 0) {
57+
onlyEven.push(datum);
58+
}
59+
});
60+
61+
return onlyEven;
62+
}
63+
});
64+
anotherCol = new MyCol([
65+
{ a : 1 },{ a : 2 },{ a : 3 },{ a : 4 }
66+
], { parse : true });
67+
68+
equal(anotherCol.length, 2);
69+
equal(anotherCol.first().get('a'), 2)
70+
equal(anotherCol.last().get('a'), 4);
71+
});
72+
5073
test("Collection: get, getByCid", 3, function() {
5174
equal(col.get(0), d);
5275
equal(col.get(2), b);

vendor/backbone/test/view.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,28 @@ $(document).ready(function() {
241241
ok(new View().$el.is('p'));
242242
});
243243

244+
test("dispose", 0, function() {
245+
var View = Backbone.View.extend({
246+
events: {click: function(){ ok(false); }},
247+
initialize: function() {
248+
this.model.on('all x', function(){ ok(false); }, this);
249+
this.collection.on('all x', function(){ ok(false); }, this);
250+
}
251+
});
252+
var view = new View({
253+
model: new Backbone.Model,
254+
collection: new Backbone.Collection
255+
});
256+
view.dispose();
257+
view.model.trigger('x');
258+
view.collection.trigger('x');
259+
view.$el.click();
260+
});
261+
262+
test("view#remove calls dispose.", 1, function() {
263+
var view = new Backbone.View();
264+
view.dispose = function() { ok(true); };
265+
view.remove();
266+
});
267+
244268
});

vendor/benchmark.js/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best
1414

1515
## Support
1616

17-
Benchmark.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1.5-13, IE 6-9, Opera 9.25-12.01, Safari 3-6, Node.js 0.8.6, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
17+
Benchmark.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1.5-13, IE 6-9, Opera 9.25-12.01, Safari 3-6, Node.js 0.8.7, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
1818

1919
## Installation and usage
2020

vendor/requirejs/require.js

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** vim: et:ts=4:sw=4:sts=4
2-
* @license RequireJS 2.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
2+
* @license RequireJS 2.0.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
33
* Available via the MIT or new BSD license.
44
* see: http://github.com/jrburke/requirejs for details
55
*/
@@ -12,7 +12,7 @@ var requirejs, require, define;
1212
(function (global) {
1313
var req, s, head, baseElement, dataMain, src,
1414
interactiveScript, currentlyAddingScript, mainScript, subPath,
15-
version = '2.0.5',
15+
version = '2.0.6',
1616
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
1717
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
1818
jsSuffixRegExp = /\.js$/,
@@ -612,7 +612,7 @@ var requirejs, require, define;
612612
});
613613
}
614614

615-
function findCycle(mod, traced) {
615+
function 10000 findCycle(mod, traced, processed) {
616616
var id = mod.map.id,
617617
depArray = mod.depMaps,
618618
foundModule;
@@ -635,28 +635,16 @@ var requirejs, require, define;
635635
var depId = depMap.id,
636636
depMod = registry[depId];
637637

638-
if (!depMod) {
638+
if (!depMod || processed[depId] ||
639+
!depMod.inited || !depMod.enabled) {
639640
return;
640641
}
641642

642-
if (!depMod.inited || !depMod.enabled) {
643-
//Dependency is not inited, so this cannot
644-
//be used to determine a cycle.
645-
foundModule = null;
646-
delete traced[id];
647-
return true;
648-
}
649-
650-
//mixin traced to a new object for each dependency, so that
651-
//sibling dependencies in this object to not generate a
652-
//false positive match on a cycle. Ideally an Object.create
653-
//type of prototype delegation would be used here, but
654-
//optimizing for file size vs. execution speed since hopefully
655-
//the trees are small for circular dependency scans relative
656-
//to the full app perf.
657-
return (foundModule = findCycle(depMod, mixin({}, traced)));
643+
return (foundModule = findCycle(depMod, traced, processed));
658644
});
659645

646+
processed[id] = true;
647+
660648
return foundModule;
661649
}
662650

@@ -779,7 +767,7 @@ var requirejs, require, define;
779767
return;
780768
}
781769

782-
var cycleMod = findCycle(mod, {}),
770+
var cycleMod = findCycle(mod, {}, {}),
783771
traced = {};
784772

785773
if (cycleMod) {

0 commit comments

Comments
 (0)
0