Make WordPress Core

Changeset 20995


Ignore:
Timestamp:
06/05/2012 12:26:57 PM (13 years ago)
Author:
koopersmith
Message:

Theme Customizer: Add an inline html5 shiv to the preview to ensure html5 elements render properly. props SergeyBiryukov, fixes #20755.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-customize-manager.php

    r20988 r20995  
    264264        wp_enqueue_script( 'customize-preview' );
    265265        add_action( 'wp_head', array( $this, 'customize_preview_base' ) );
     266        add_action( 'wp_head', array( $this, 'customize_preview_html5' ) );
    266267        add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 );
    267268        add_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 );
     
    282283    public function customize_preview_base() {
    283284        ?><base href="<?php echo home_url( '/' ); ?>" /><?php
     285    }
     286
     287    /**
     288     * Print a workaround to handle HTML5 tags in IE < 9
     289     *
     290     * @since 3.4.0
     291     */
     292    public function customize_preview_html5() { ?>
     293        <!--[if lt IE 9]>
     294        <script type="text/javascript">
     295            var e = [ 'abbr', 'article', 'aside', 'audio', 'canvas', 'datalist', 'details',
     296                'figure', 'footer', 'header', 'hgroup', 'mark', 'menu', 'meter', 'nav',
     297                'output', 'progress', 'section', 'time', 'video' ];
     298            for ( var i = 0; i < e.length; i++ ) {
     299                document.createElement( e[i] );
     300            }
     301        </script>
     302        <![endif]--><?php
    284303    }
    285304
Note: See TracChangeset for help on using the changeset viewer.