WordPress.org

Make WordPress Core

Changeset 20919


Ignore:
Timestamp:
05/25/2012 10:43:11 PM (7 years ago)
Author:
koopersmith
Message:

Theme Customizer: Correctly use custom-background class in theme preview. See #19910.

File:
1 edited

Legend:

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

    r20908 r20919  
    8282
    8383        api.when.apply( api, bg ).done( function( color, image, position_x, repeat, attachment ) {
    84             var style = $('#custom-background-css'),
     84            var body  = $(document.body),
     85                style = $('#custom-background-css'),
    8586                update;
    8687
     88            // If custom backgrounds are active and we can't find the
     89            // default output, bail.
     90            if ( body.hasClass('custom-background') && ! style.length )
     91                return;
     92
     93            // Create the CSS container if it doesn't already exist.
    8794            if ( ! style.length )
    88                 return;
     95                style = $('<style type="text/css" id="custom-background-css" />').appendTo('head');
    8996
    9097            update = function() {
    9198                var css = '';
     99
     100                // The body will support custom backgrounds if either
     101                // the color or image are set.
     102                //
     103                // See get_body_class() in /wp-includes/post-template.php
     104                body.toggleClass( 'custom-background', !! ( color() || image() ) );
    92105
    93106                if ( color() )
Note: See TracChangeset for help on using the changeset viewer.