Make WordPress Core

Changeset 20930


Ignore:
Timestamp:
05/26/2012 07:02:28 AM (14 years ago)
Author:
koopersmith
Message:

Theme Customizer: Fix preview background CSS creation to insert/remove style nodes (for IE8 compatibility). fixes #20582, see #19910.

File:
1 edited

Legend:

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

    r20919 r20930  
    8282
    8383                api.when.apply( api, bg ).done( function( color, image, position_x, repeat, attachment ) {
    84                         var body  = $(document.body),
     84                        var body = $(document.body),
     85                                head = $('head'),
    8586                                style = $('#custom-background-css'),
    8687                                update;
    … …  
    9091                        if ( body.hasClass('custom-background') && ! style.length )
    9192                                return;
    92 
    93                         // Create the CSS container if it doesn't already exist.
    94                         if ( ! style.length )
    95                                 style = $('<style type="text/css" id="custom-background-css" />').appendTo('head');
    9693
    9794                        update = function() {
    … …  
    114111                                }
    115112
    116                                 style.html( 'body.custom-background { ' + css + ' }' );
     113                                // Refresh the stylesheet by removing and recreating it.
     114                                style.remove();
     115                                style = $('<style type="text/css" id="custom-background-css">body.custom-background { ' + css + ' }</style>').appendTo( head );
    117116                        };
    118117
Note: See TracChangeset for help on using the changeset viewer.