Make WordPress Core

Changeset 41952


Ignore:
Timestamp:
10/20/2017 03:29:30 AM (9 years ago)
Author:
westonruter
Message:

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.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-controls.js

    r41950 r41952  
    38983898                        templateId = control.templateSelector;
    38993899
    3900                         // Use default content template when a standard HTML type is used and there isn't a more specific template existing.
    3901                         if ( templateId === 'customize-control-' + control.params.type + '-content' && _.contains( standardTypes, control.params.type ) && ! document.getElementById( 'tmpl-' + templateId ) ) {
     3900                        // 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.
     3901                        if ( templateId === 'customize-control-' + control.params.type + '-content' &&
     3902                                _.contains( standardTypes, control.params.type ) &&
     3903                                ! document.getElementById( 'tmpl-' + templateId ) &&
     3904                                0 === control.container.children().length )
     3905                        {
    39023906                                templateId = 'customize-control-default-content';
    39033907                        }
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r41936 r41952  
    40204020                                                >{{ inputAttrs.value }}</textarea>
    40214021                                        <# } else if ( 'select' === data.type ) { #>
     4022                                                <# delete inputAttrs.type; #>
    40224023                                                <select
    40234024                                                        <# _.each( _.extend( inputAttrs ), function( value, key ) { #>
Note: See TracChangeset for help on using the changeset viewer.