Make WordPress Core

Changeset 20259


Ignore:
Timestamp:
03/22/2012 07:03:44 AM (13 years ago)
Author:
koopersmith
Message:

Theme Customizer: Ensure background_color and background_image exist instead of blindly attempting to access their controls. see #19910.

Location:
trunk/wp-includes/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/customize-controls.dev.js

    r20253 r20259  
    250250
    251251        // Background color uses postMessage by default
    252         api('background_color').method = 'postMessage';
    253 
    254         // api('background_image').method = 'postMessage';
    255         api('background_image').uploader.param( 'post_data[context]', 'custom-background' );
     252        api( 'background_color', function( control ) {
     253            control.method = 'postMessage';
     254        });
     255
     256        api( 'background_image', function( control ) {
     257            control.uploader.param( 'post_data[context]', 'custom-background' );
     258        });
    256259    });
    257260
  • trunk/wp-includes/js/customize-preview.dev.js

    r20123 r20259  
    6969        body = $(document.body);
    7070        // Auto update background color by default
    71         api.bind( 'background_color', function( to ) {
    72             body.css( 'background-color', '#' + to );
     71        api( 'background_color', function( value ) {
     72            value.bind( function( to ) {
     73                body.css( 'background-color', '#' + to );
     74            });
    7375        });
    7476    });
Note: See TracChangeset for help on using the changeset viewer.