Customize: Consolidate sourcing of control `params`.

Prevent needlessly iterating over `controlConstructor` to find `type` when it is already supplied.

Amends [41750], [41726].
See #42083.

Built from https://develop.svn.wordpress.org/trunk@42048


git-svn-id: http://core.svn.wordpress.org/trunk@41882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-10-31 02:59:47 +00:00
parent 274792f9cd
commit 8a1dc558a1
3 changed files with 8 additions and 4 deletions

View File

@ -3466,7 +3466,12 @@
initialize: function( id, options ) { initialize: function( id, options ) {
var control = this, deferredSettingIds = [], settings, gatherSettings; var control = this, deferredSettingIds = [], settings, gatherSettings;
control.params = _.extend( {}, control.defaults ); control.params = _.extend(
{},
control.defaults,
control.params || {}, // In case sub-class already defines.
options.params || options || {} // The options.params property is deprecated, but it is checked first for back-compat.
);
if ( ! api.Control.instanceCounter ) { if ( ! api.Control.instanceCounter ) {
api.Control.instanceCounter = 0; api.Control.instanceCounter = 0;
@ -3487,7 +3492,6 @@
} ); } );
} }
_.extend( control.params, options.params || options );
if ( ! control.params.content ) { if ( ! control.params.content ) {
control.params.content = $( '<li></li>', { control.params.content = $( '<li></li>', {
id: 'customize-control-' + id.replace( /]/g, '' ).replace( /\[/g, '-' ), id: 'customize-control-' + id.replace( /]/g, '' ).replace( /\[/g, '-' ),

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-beta4-42047'; $wp_version = '4.9-beta4-42048';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.