mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-02 21:51:26 +01:00
Theme Customizer: Fix preview background CSS creation to insert/remove style nodes (for IE8 compatibility). fixes #20582, see #19910.
git-svn-id: http://core.svn.wordpress.org/trunk@20930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
71b00f37aa
commit
2d111e1c37
@ -81,7 +81,8 @@
|
||||
});
|
||||
|
||||
api.when.apply( api, bg ).done( function( color, image, position_x, repeat, attachment ) {
|
||||
var body = $(document.body),
|
||||
var body = $(document.body),
|
||||
head = $('head'),
|
||||
style = $('#custom-background-css'),
|
||||
update;
|
||||
|
||||
@ -90,10 +91,6 @@
|
||||
if ( body.hasClass('custom-background') && ! style.length )
|
||||
return;
|
||||
|
||||
// Create the CSS container if it doesn't already exist.
|
||||
if ( ! style.length )
|
||||
style = $('<style type="text/css" id="custom-background-css" />').appendTo('head');
|
||||
|
||||
update = function() {
|
||||
var css = '';
|
||||
|
||||
@ -113,7 +110,9 @@
|
||||
css += 'background-position: top ' + attachment() + ';';
|
||||
}
|
||||
|
||||
style.html( 'body.custom-background { ' + css + ' }' );
|
||||
// Refresh the stylesheet by removing and recreating it.
|
||||
style.remove();
|
||||
style = $('<style type="text/css" id="custom-background-css">body.custom-background { ' + css + ' }</style>').appendTo( head );
|
||||
};
|
||||
|
||||
$.each( arguments, function() {
|
||||
|
Loading…
Reference in New Issue
Block a user