Customize: Harden color control's logic for obtaining default value to prevent JS error when non-string default supplied.

Props andreagobetti, yonivh for testing.
Fixes #37174.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-08-16 19:04:47 +00:00
parent e06146a9b5
commit ea92bb5f10
2 changed files with 2 additions and 3 deletions

View File

@ -91,8 +91,7 @@ class WP_Customize_Color_Control extends WP_Customize_Control {
?>
<# var defaultValue = '#RRGGBB', defaultValueAttr = '',
isHueSlider = data.mode === 'hue';
if ( data.defaultValue && ! isHueSlider ) {
if ( data.defaultValue && _.isString( data.defaultValue ) && ! isHueSlider ) {
if ( '#' !== data.defaultValue.substring( 0, 1 ) ) {
defaultValue = '#' + data.defaultValue;
} else {

View File

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