Lines Matching refs:_

17     define(['underscore', 'jquery', 'exports'], function(_, $, exports) {  argument
20 root.Backbone = factory(root, exports, _, $);
25 var _ = require('underscore'), $; variable
27 factory(root, exports, _, $);
31 root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
34 })(function(root, Backbone, _, $) { argument
81 return _[method](this[attribute]);
84 return _[method](this[attribute], value);
87 return _[method](this[attribute], cb(iteratee, this), context);
90 return _[method](this[attribute], cb(iteratee, this), defaultVal, context);
95 return _[method].apply(_, args);
100 _.each(methods, function(length, method) {
101 if (_[method]) Class.prototype[method] = addMethod(length, method, attribute);
107 if (_.isFunction(iteratee)) return iteratee;
108 if (_.isObject(iteratee) && !instance._isModel(iteratee)) return modelMatcher(iteratee);
109 if (_.isString(iteratee)) return function(model) { return model.get(iteratee); };
113 var matcher = _.matches(attrs);
145 for (names = _.keys(name); i < names.length ; i++) {
187 var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
194 var thisId = this._listenId || (this._listenId = _.uniqueId('l'));
234 var ids = obj ? [obj._listenId] : _.keys(listeningTo);
258 var ids = _.keys(listeners);
267 var names = name ? [name] : _.keys(events);
310 var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this));
318 var events = eventsApi(onceMap, {}, name, callback, _.bind(this.stopListening, this, obj));
326 var once = map[name] = _.once(function() {
382 _.extend(Backbone, Events);
398 this.cid = _.uniqueId(this.cidPrefix);
402 var defaults = _.result(this, 'defaults');
403 attrs = _.defaults(_.extend({}, defaults, attrs), defaults);
410 _.extend(Model.prototype, Events, {
436 return _.clone(this.attributes);
452 return _.escape(this.get(attr));
463 return !!_.iteratee(attrs, this)(this.attributes);
494 this._previousAttributes = _.clone(this.attributes);
505 if (!_.isEqual(current[attr], val)) changes.push(attr);
506 if (!_.isEqual(prev[attr], val)) {
543 return this.set(attr, void 0, _.extend({}, options, {unset: true}));
550 return this.set(attrs, _.extend({}, options, {unset: true}));
556 if (attr == null) return !_.isEmpty(this.changed);
557 return _.has(this.changed, attr);
567 if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
573 if (_.isEqual(old[attr], val)) continue;
590 return _.clone(this._previousAttributes);
596 options = _.extend({parse: true}, options);
622 options = _.extend({validate: true, parse: true}, options);
643 if (wait) serverAttrs = _.extend({}, attrs, serverAttrs);
651 if (attrs && wait) this.attributes = _.extend({}, attributes, attrs);
667 options = options ? _.clone(options) : {};
685 _.defer(options.success);
699 _.result(this, 'urlRoot') ||
700 _.result(this.collection, 'url') ||
725 return this._validate({}, _.extend({}, options, {validate: true}));
732 attrs = _.extend({}, this.attributes, attrs);
735 this.trigger('invalid', this, error, _.extend(options, {validationError: error}));
769 if (models) this.reset(models, _.extend({silent: true}, options));
788 _.extend(Collection.prototype, Events, {
818 return this.set(models, _.extend({merge: false}, options, addOptions));
823 options = _.extend({}, options);
824 var singular = !_.isArray(models);
841 options = _.extend({}, setOptions, options);
846 var singular = !_.isArray(models);
866 var sortAttr = _.isString(this.comparator) ? this.comparator : null;
916 orderChanged = this.length !== set.length || _.some(this.models, function(m, index) {
958 options = options ? _.clone(options) : {};
964 models = this.add(models, _.extend({silent: true}, options));
971 return this.add(model, _.extend({at: this.length}, options));
982 return this.add(model, _.extend({at: 0}, options));
1037 if (_.isFunction(comparator)) comparator = _.bind(comparator, this);
1040 if (length === 1 || _.isString(comparator)) {
1058 options = _.extend({parse: true}, options);
1075 options = options ? _.clone(options) : {};
1124 options = options ? _.clone(options) : {};
1234 this.cid = _.uniqueId('view');
1236 _.extend(this, _.pick(options, viewOptions));
1248 _.extend(View.prototype, Events, {
1322 events || (events = _.result(this, 'events'));
1327 if (!_.isFunction(method)) method = this[method];
1330 this.delegate(match[1], match[2], _.bind(method, this));
1370 var attrs = _.extend({}, _.result(this, 'attributes'));
1371 if (this.id) attrs.id = _.result(this, 'id');
1372 if (this.className) attrs['class'] = _.result(this, 'className');
1373 this.setElement(this._createElement(_.result(this, 'tagName')));
1376 this.setElement(_.result(this, 'el'));
1410 _.defaults(options || (options = {}), {
1420 params.url = _.result(model, 'url') || urlError();
1461 var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
1502 _.extend(Router.prototype, Events, {
1519 if (!_.isRegExp(route)) route = this._routeToRegExp(route);
1520 if (_.isFunction(name)) {
1554 this.routes = _.result(this, 'routes');
1555 var route, routes = _.keys(this.routes);
1578 return _.map(params, function(param, i) {
1597 this.checkUrl = _.bind(this.checkUrl, this);
1619 _.extend(History.prototype, Events, {
1687 this.options = _.extend({root: '/'}, this.options, options);
1809 return _.some(this.handlers, function(handler) {
1907 if (protoProps && _.has(protoProps, 'constructor')) {
1914 _.extend(child, parent, staticProps);
1918 child.prototype = _.create(parent.prototype, protoProps);