Theme Customizer: Add CORS checks to the initial check for customize support. Prevents flash of customize links on large pages. see #20582, #19910.

Add wp_customize_support_script(), to quickly alter the body class based on whether customize is supported.


git-svn-id: https://develop.svn.wordpress.org/trunk@20893 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith
2012-05-25 00:15:12 +00:00
parent d074d1c69f
commit b1a672cdfa
2 changed files with 43 additions and 7 deletions

View File

@@ -97,15 +97,10 @@ $admin_body_class .= ' no-customize-support';
<body class="wp-admin no-js <?php echo apply_filters( 'admin_body_class', '' ) . " $admin_body_class"; ?>">
<script type="text/javascript">
document.body.className = document.body.className.replace('no-js','js');
<?php
// If the customize loader is enqueued, then add the 'customize-support' class early.
// This prevents a flash of unstyled content.
if ( wp_script_is( 'customize-loader', 'queue' ) ) : ?>
if ( window.postMessage )
document.body.className = document.body.className.replace('no-customize-support','customize-support');
<?php endif; ?>
</script>
<?php wp_customize_support_script(); ?>
<div id="wpwrap">
<?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
<div id="wpcontent">