Update Backbone from 1.0 to 1.1.

Also update Underscore to 1.6. Includes the development versions of both, which are not included in the build.

Here is Backbone's changelog:
 * Made the return values of Collection’s `set`, `add`, `remove`, and `reset` more useful. Instead of returning `this`, they now return the changed (added, removed or updated) model or list of 
models. (This means they can no longer be chained.)
 * Backbone Views no longer automatically attach options passed to the constructor as `this.options` and Backbone Models no longer attach `url` and `urlRoot` options, but you can do it yourself if you prefer. (But if you extend `wp.Backbone.View`, options will be attached for you.)
 * All `"invalid"` events now pass consistent arguments. First the model in question, then the error object, then options.
 * You are no longer permitted to change the id of your model during `parse`. Use `idAttribute` instead.
 * On the other hand, `parse` is now an excellent place to extract and vivify incoming nested JSON into associated submodels.

See [27171] (next commit) for changes made to WordPress to be compatible with Backbone 1.1.

props gcorne, georgestephanis.
see #26799.


git-svn-id: https://develop.svn.wordpress.org/trunk@27170 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2014-02-13 07:33:29 +00:00
parent fcea323396
commit 4e36f55df7
6 changed files with 2940 additions and 14 deletions

View File

@@ -50,8 +50,11 @@ require( ABSPATH . WPINC . '/functions.wp-styles.php' );
function wp_default_scripts( &$scripts ) {
include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
if ( ! defined( 'SCRIPT_DEBUG' ) )
define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) );
$develop_src = false !== strpos( $wp_version, '-src' );
if ( ! defined( 'SCRIPT_DEBUG' ) ) {
define( 'SCRIPT_DEBUG', $develop_src );
}
if ( ! $guessurl = site_url() ) {
$guessed_url = true;
@@ -64,6 +67,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->default_dirs = array('/wp-admin/js/', '/wp-includes/js/');
$suffix = SCRIPT_DEBUG ? '' : '.min';
$dev_suffix = $develop_src ? '' : '.min';
$scripts->add( 'utils', "/wp-includes/js/utils$suffix.js" );
did_action( 'init' ) && $scripts->localize( 'utils', 'userSettings', array(
@@ -270,8 +274,8 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2011-02-23');
$scripts->add( 'underscore', '/wp-includes/js/underscore.min.js', array(), '1.4.4', 1 );
$scripts->add( 'backbone', '/wp-includes/js/backbone.min.js', array('underscore','jquery'), '1.0.0', 1 );
$scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.6.0', 1 );
$scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore','jquery' ), '1.1.0', 1 );
$scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array('underscore', 'jquery'), false, 1 );
did_action( 'init' ) && $scripts->localize( 'wp-util', '_wpUtilSettings', array(