External Libraries: Update Backbone.js to version `1.5.0`.
This release contains bug fixes and documentation improvements. A full list of changes can be found on GitHub: https://github.com/jashkenas/backbone/compare/1.4.1...1.5.0. Props rajinsharwar, hareesh-pillai. Fixes #58930. Built from https://develop.svn.wordpress.org/trunk@56391 git-svn-id: http://core.svn.wordpress.org/trunk@55903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
afd36de0b5
commit
43e676dedb
|
@ -1,4 +1,4 @@
|
|||
// Backbone.js 1.4.1
|
||||
// Backbone.js 1.5.0
|
||||
|
||||
// (c) 2010-2022 Jeremy Ashkenas and DocumentCloud
|
||||
// Backbone may be freely distributed under the MIT license.
|
||||
|
@ -44,7 +44,7 @@
|
|||
var slice = Array.prototype.slice;
|
||||
|
||||
// Current version of the library. Keep in sync with `package.json`.
|
||||
Backbone.VERSION = '1.4.1';
|
||||
Backbone.VERSION = '1.5.0';
|
||||
|
||||
// For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
|
||||
// the `$` variable.
|
||||
|
@ -404,7 +404,11 @@
|
|||
if (options.collection) this.collection = options.collection;
|
||||
if (options.parse) attrs = this.parse(attrs, options) || {};
|
||||
var defaults = _.result(this, 'defaults');
|
||||
|
||||
// Just _.defaults would work fine, but the additional _.extends
|
||||
// is in there for historical reasons. See #3843.
|
||||
attrs = _.defaults(_.extend({}, defaults, attrs), defaults);
|
||||
|
||||
this.set(attrs, options);
|
||||
this.changed = {};
|
||||
this.initialize.apply(this, arguments);
|
||||
|
@ -1080,9 +1084,23 @@
|
|||
var collection = this;
|
||||
var success = options.success;
|
||||
options.success = function(m, resp, callbackOpts) {
|
||||
if (wait) collection.add(m, callbackOpts);
|
||||
if (wait) {
|
||||
m.off('error', this._forwardPristineError, this);
|
||||
collection.add(m, callbackOpts);
|
||||
}
|
||||
if (success) success.call(callbackOpts.context, m, resp, callbackOpts);
|
||||
};
|
||||
// In case of wait:true, our collection is not listening to any
|
||||
// of the model's events yet, so it will not forward the error
|
||||
// event. In this special case, we need to listen for it
|
||||
// separately and handle the event just once.
|
||||
// (The reason we don't need to do this for the sync event is
|
||||
// in the success handler above: we add the model first, which
|
||||
// causes the collection to listen, and then invoke the callback
|
||||
// that triggers the event.)
|
||||
if (wait) {
|
||||
model.once('error', this._forwardPristineError, this);
|
||||
}
|
||||
model.save(null, options);
|
||||
return model;
|
||||
},
|
||||
|
@ -1177,6 +1195,7 @@
|
|||
removed.push(model);
|
||||
this._removeReference(model, options);
|
||||
}
|
||||
if (models.length > 0 && !options.silent) delete options.index;
|
||||
return removed;
|
||||
},
|
||||
|
||||
|
@ -1219,8 +1238,19 @@
|
|||
}
|
||||
}
|
||||
this.trigger.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
// Internal callback method used in `create`. It serves as a
|
||||
// stand-in for the `_onModelEvent` method, which is not yet bound
|
||||
// during the `wait` period of the `create` call. We still want to
|
||||
// forward any `'error'` event at the end of the `wait` period,
|
||||
// hence a customized callback.
|
||||
_forwardPristineError: function(model, collection, options) {
|
||||
// Prevent double forward if the model was already in the
|
||||
// collection before the call to `create`.
|
||||
if (this.has(model)) return;
|
||||
this._onModelEvent('error', model, collection, options);
|
||||
}
|
||||
});
|
||||
|
||||
// Defining an @@iterator method implements JavaScript's Iterable protocol.
|
||||
|
@ -1846,6 +1876,7 @@
|
|||
// Is pushState desired ... is it available?
|
||||
this.options = _.extend({root: '/'}, this.options, options);
|
||||
this.root = this.options.root;
|
||||
this._trailingSlash = this.options.trailingSlash;
|
||||
this._wantsHashChange = this.options.hashChange !== false;
|
||||
this._hasHashChange = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7);
|
||||
this._useHashChange = this._wantsHashChange && this._hasHashChange;
|
||||
|
@ -1988,9 +2019,9 @@
|
|||
// Normalize the fragment.
|
||||
fragment = this.getFragment(fragment || '');
|
||||
|
||||
// Don't include a trailing slash on the root.
|
||||
// Strip trailing slash on the root unless _trailingSlash is true
|
||||
var rootPath = this.root;
|
||||
if (fragment === '' || fragment.charAt(0) === '?') {
|
||||
if (!this._trailingSlash && (fragment === '' || fragment.charAt(0) === '?')) {
|
||||
rootPath = rootPath.slice(0, -1) || '/';
|
||||
}
|
||||
var url = rootPath + fragment;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1013,7 +1013,7 @@ function wp_default_scripts( $scripts ) {
|
|||
did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', 'lt IE 8' );
|
||||
|
||||
$scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.13.4', 1 );
|
||||
$scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore', 'jquery' ), '1.4.1', 1 );
|
||||
$scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore', 'jquery' ), '1.5.0', 1 );
|
||||
|
||||
$scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array( 'underscore', 'jquery' ), false, 1 );
|
||||
did_action( 'init' ) && $scripts->localize(
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.4-alpha-56390';
|
||||
$wp_version = '6.4-alpha-56391';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue