mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-14 17:37:54 -05:00
Re #3029 Guard against unavailable edge underscore proxies
This commit is contained in:
@@ -597,6 +597,7 @@
|
||||
|
||||
// Mix in each Underscore method as a proxy to `Model#attributes`.
|
||||
_.each(modelMethods, function(method) {
|
||||
if (!_[method]) return;
|
||||
Model.prototype[method] = function() {
|
||||
var args = slice.call(arguments);
|
||||
args.unshift(this.attributes);
|
||||
@@ -978,6 +979,7 @@
|
||||
|
||||
// Mix in each Underscore method as a proxy to `Collection#models`.
|
||||
_.each(methods, function(method) {
|
||||
if (!_[method]) return;
|
||||
Collection.prototype[method] = function() {
|
||||
var args = slice.call(arguments);
|
||||
args.unshift(this.models);
|
||||
@@ -990,6 +992,7 @@
|
||||
|
||||
// Use attributes instead of properties.
|
||||
_.each(attributeMethods, function(method) {
|
||||
if (!_[method]) return;
|
||||
Collection.prototype[method] = function(value, context) {
|
||||
var iterator = _.isFunction(value) ? value : function(model) {
|
||||
return model.get(value);
|
||||
|
||||
Reference in New Issue
Block a user