Customizer: Don't trigger a change event if two unchanged object values are equal, second pass.

Make Underscore.js a dependency for `customize-base` and use `_.isEqual()` to compare the values.
(Underscore.js was already enqueued via wp-util.js for Widgets.)

props westonruter.
fixes #26061.
Built from https://develop.svn.wordpress.org/trunk@29907


git-svn-id: http://core.svn.wordpress.org/trunk@29661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2014-10-15 18:26:17 +00:00
parent 4020eacd8b
commit b89c915ed6
3 changed files with 3 additions and 3 deletions

View File

@ -184,7 +184,7 @@ window.wp = window.wp || {};
to = this.validate( to ); to = this.validate( to );
// Bail if the sanitized value is null or unchanged. // Bail if the sanitized value is null or unchanged.
if ( null === to || this._value === to ) if ( null === to || _.isEqual( from, to ) )
return this; return this;
this._value = to; this._value = to;

File diff suppressed because one or more lines are too long

View File

@ -377,7 +377,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), 'r7', 1 ); $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), 'r7', 1 );
$scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'json2' ), false, 1 ); $scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'json2', 'underscore' ), false, 1 );
$scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 ); $scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 );
$scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'customize-base' ), false, 1 ); $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'customize-base' ), false, 1 );
$scripts->add( 'customize-models', "/wp-includes/js/customize-models.js", array( 'underscore', 'backbone' ), false, 1 ); $scripts->add( 'customize-models', "/wp-includes/js/customize-models.js", array( 'underscore', 'backbone' ), false, 1 );