Make WordPress Core


Ignore:
Timestamp:
09/25/2016 04:34:34 AM (10 years ago)
Author:
westonruter
Message:

Customize: Opt to disable IE8 support via conditional comments instead of using unreliable Array.prototype.indexOf feature detection.

Deprecate/remove WP_Customize_Manager::customize_preview_html5() and remove document.head polyfill, both of which were only in place for IE8 support.

Props ryankienstra, westonruter.
Fixes #38021.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r38627 r38649  
    21522152 *
    21532153 * @since 3.4.0
     2154 * @since 4.7.0 Support for IE8 and below is explicitly removed via conditional comments.
    21542155 */
    21552156function wp_customize_support_script() {
     
    21592160
    21602161        ?>
    2161         <script type="text/javascript">
    2162                 (function() {
    2163                         var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)');
    2164 
    2165 <?php           if ( $cross_domain ): ?>
    2166                         request = (function(){ var xhr = new XMLHttpRequest(); return ('withCredentials' in xhr); })();
    2167 <?php           else: ?>
    2168                         request = true;
    2169 <?php           endif; ?>
    2170 
    2171                         b[c] = b[c].replace( rcs, ' ' );
    2172                         b[c] += ( window.postMessage && request && Array.prototype.indexOf ? ' ' : ' no-' ) + cs;
    2173                 }());
    2174         </script>
     2162        <!--[if lte IE 8]>
     2163                <script type="text/javascript">
     2164                        document.body.className = document.body.className.replace( /(^|\s)(no-)?customize-support(?=\s|$)/, '' ) + ' no-customize-support';
     2165                </script>
     2166        <![endif]-->
     2167        <!--[if gte IE 9]><!-->
     2168                <script type="text/javascript">
     2169                        (function() {
     2170                                var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)');
     2171
     2172                <?php   if ( $cross_domain ) : ?>
     2173                                request = (function(){ var xhr = new XMLHttpRequest(); return ('withCredentials' in xhr); })();
     2174                <?php   else : ?>
     2175                                request = true;
     2176                <?php   endif; ?>
     2177
     2178                                b[c] = b[c].replace( rcs, ' ' );
     2179                                // The customizer requires postMessage and CORS (if the site is cross domain)
     2180                                b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs;
     2181                        }());
     2182                </script>
     2183        <!--<![endif]-->
    21752184        <?php
    21762185}
Note: See TracChangeset for help on using the changeset viewer.