Update of multiple frontend libs.
This commit is contained in:
parent
de261dbde5
commit
a9c6ddc03b
276 changed files with 41257 additions and 19300 deletions
|
@ -394,6 +394,7 @@
|
|||
var Model = Backbone.Model = function(attributes, options) {
|
||||
var attrs = attributes || {};
|
||||
options || (options = {});
|
||||
this.preinitialize.apply(this, arguments);
|
||||
this.cid = _.uniqueId(this.cidPrefix);
|
||||
this.attributes = {};
|
||||
if (options.collection) this.collection = options.collection;
|
||||
|
@ -422,6 +423,10 @@
|
|||
// You may want to override this if you're experiencing name clashes with model ids.
|
||||
cidPrefix: 'c',
|
||||
|
||||
// preinitialize is an empty function by default. You can override it with a function
|
||||
// or object. preinitialize will run before any instantiation logic is run in the Model.
|
||||
preinitialize: function(){},
|
||||
|
||||
// Initialize is an empty function by default. Override it with your own
|
||||
// initialization logic.
|
||||
initialize: function(){},
|
||||
|
@ -562,12 +567,14 @@
|
|||
if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
|
||||
var old = this._changing ? this._previousAttributes : this.attributes;
|
||||
var changed = {};
|
||||
var hasChanged;
|
||||
for (var attr in diff) {
|
||||
var val = diff[attr];
|
||||
if (_.isEqual(old[attr], val)) continue;
|
||||
changed[attr] = val;
|
||||
hasChanged = true;
|
||||
}
|
||||
return _.size(changed) ? changed : false;
|
||||
return hasChanged ? changed : false;
|
||||
},
|
||||
|
||||
// Get the previous value of an attribute, recorded at the time the last
|
||||
|
@ -754,6 +761,7 @@
|
|||
// its models in sort order, as they're added and removed.
|
||||
var Collection = Backbone.Collection = function(models, options) {
|
||||
options || (options = {});
|
||||
this.preinitialize.apply(this, arguments);
|
||||
if (options.model) this.model = options.model;
|
||||
if (options.comparator !== void 0) this.comparator = options.comparator;
|
||||
this._reset();
|
||||
|
@ -783,6 +791,11 @@
|
|||
// This should be overridden in most cases.
|
||||
model: Model,
|
||||
|
||||
|
||||
// preinitialize is an empty function by default. You can override it with a function
|
||||
// or object. preinitialize will run before any instantiation logic is run in the Collection.
|
||||
preinitialize: function(){},
|
||||
|
||||
// Initialize is an empty function by default. Override it with your own
|
||||
// initialization logic.
|
||||
initialize: function(){},
|
||||
|
@ -1219,6 +1232,7 @@
|
|||
// if an existing element is not provided...
|
||||
var View = Backbone.View = function(options) {
|
||||
this.cid = _.uniqueId('view');
|
||||
this.preinitialize.apply(this, arguments);
|
||||
_.extend(this, _.pick(options, viewOptions));
|
||||
this._ensureElement();
|
||||
this.initialize.apply(this, arguments);
|
||||
|
@ -1242,6 +1256,10 @@
|
|||
return this.$el.find(selector);
|
||||
},
|
||||
|
||||
// preinitialize is an empty function by default. You can override it with a function
|
||||
// or object. preinitialize will run before any instantiation logic is run in the View
|
||||
preinitialize: function(){},
|
||||
|
||||
// Initialize is an empty function by default. Override it with your own
|
||||
// initialization logic.
|
||||
initialize: function(){},
|
||||
|
@ -1467,6 +1485,7 @@
|
|||
// matched. Creating a new one sets its `routes` hash, if not set statically.
|
||||
var Router = Backbone.Router = function(options) {
|
||||
options || (options = {});
|
||||
this.preinitialize.apply(this, arguments);
|
||||
if (options.routes) this.routes = options.routes;
|
||||
this._bindRoutes();
|
||||
this.initialize.apply(this, arguments);
|
||||
|
@ -1482,6 +1501,10 @@
|
|||
// Set up all inheritable **Backbone.Router** properties and methods.
|
||||
_.extend(Router.prototype, Events, {
|
||||
|
||||
// preinitialize is an empty function by default. You can override it with a function
|
||||
// or object. preinitialize will run before any instantiation logic is run in the Router.
|
||||
preinitialize: function(){},
|
||||
|
||||
// Initialize is an empty function by default. Override it with your own
|
||||
// initialization logic.
|
||||
initialize: function(){},
|
||||
|
@ -1812,11 +1835,14 @@
|
|||
}
|
||||
var url = rootPath + fragment;
|
||||
|
||||
// Strip the hash and decode for matching.
|
||||
fragment = this.decodeFragment(fragment.replace(pathStripper, ''));
|
||||
// Strip the fragment of the query and hash for matching.
|
||||
fragment = fragment.replace(pathStripper, '');
|
||||
|
||||
if (this.fragment === fragment) return;
|
||||
this.fragment = fragment;
|
||||
// Decode for matching.
|
||||
var decodedFragment = this.decodeFragment(fragment);
|
||||
|
||||
if (this.fragment === decodedFragment) return;
|
||||
this.fragment = decodedFragment;
|
||||
|
||||
// If pushState is available, we use it to set the fragment as a real URL.
|
||||
if (this._usePushState) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue