From 5338b8fd73edf2d8ef38b8e0466f67ad9510fd83 Mon Sep 17 00:00:00 2001 From: koopersmith Date: Tue, 6 Mar 2012 02:14:27 +0000 Subject: [PATCH] Theme Customizer: Ensure color pickers initialize to the correct color. see #19910. git-svn-id: http://svn.automattic.com/wordpress/trunk@20121 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/customize-controls.dev.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/js/customize-controls.dev.js b/wp-includes/js/customize-controls.dev.js index 7854a5a8b9..37478a5f2f 100644 --- a/wp-includes/js/customize-controls.dev.js +++ b/wp-includes/js/customize-controls.dev.js @@ -172,7 +172,7 @@ parent = picker.parent(), toggle = parent.siblings('a'), value = api( parent.siblings('input').prop('name').replace( api.settings.prefix, '' ) ), - farb; + farb, update; value.validate = validateColor; text.link( value ); @@ -182,11 +182,14 @@ value.set( color.replace( '#', '' ) ); }); - value.bind( function( color ) { + update = function( color ) { color = '#' + color; toggle.css( 'background', color ); farb.setColor( color ); - }); + }; + + value.bind( update ); + update( value() ); }); $('.color-picker a').click( function(e) {