Customize: Prevent using default template for a base control when it has content rendered on the server.

Also prevent invalid `type` attribute from being added to a `select` element.

See #30738.
Fixes #42286.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-10-20 03:30:46 +00:00
parent 6913ad9219
commit a402312a8d
4 changed files with 9 additions and 4 deletions

View File

@ -3897,8 +3897,12 @@
templateId = control.templateSelector;
// Use default content template when a standard HTML type is used and there isn't a more specific template existing.
if ( templateId === 'customize-control-' + control.params.type + '-content' && _.contains( standardTypes, control.params.type ) && ! document.getElementById( 'tmpl-' + templateId ) ) {
// Use default content template when a standard HTML type is used, there isn't a more specific template existing, and the control container is empty.
if ( templateId === 'customize-control-' + control.params.type + '-content' &&
_.contains( standardTypes, control.params.type ) &&
! document.getElementById( 'tmpl-' + templateId ) &&
0 === control.container.children().length )
{
templateId = 'customize-control-default-content';
}

File diff suppressed because one or more lines are too long

View File

@ -4019,6 +4019,7 @@ final class WP_Customize_Manager {
<# }); #>
>{{ inputAttrs.value }}</textarea>
<# } else if ( 'select' === data.type ) { #>
<# delete inputAttrs.type; #>
<select
<# _.each( _.extend( inputAttrs ), function( value, key ) { #>
{{{ key }}}="{{ value }}"

View File

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