WordPress.org

Make WordPress Core

Changeset 38649


Ignore:
Timestamp:
09/25/16 04:34:34 (9 months 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.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

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

    r38624 r38649  
    741741        add_action( 'wp', array( $this, 'customize_preview_override_404_status' ) ); 
    742742        add_action( 'wp_head', array( $this, 'customize_preview_base' ) ); 
    743         add_action( 'wp_head', array( $this, 'customize_preview_html5' ) ); 
    744743        add_action( 'wp_head', array( $this, 'customize_preview_loading_style' ) ); 
    745744        add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 ); 
     
    788787     * 
    789788     * @since 3.4.0 
    790      */ 
    791     public function customize_preview_html5() { ?> 
    792         <!--[if lt IE 9]> 
    793         <script type="text/javascript"> 
    794             var e = [ 'abbr', 'article', 'aside', 'audio', 'canvas', 'datalist', 'details', 
    795                 'figure', 'footer', 'header', 'hgroup', 'mark', 'menu', 'meter', 'nav', 
    796                 'output', 'progress', 'section', 'time', 'video' ]; 
    797             for ( var i = 0; i < e.length; i++ ) { 
    798                 document.createElement( e[i] ); 
    799             } 
    800         </script> 
    801         <![endif]--><?php 
     789     * @deprecated 4.7.0 Customizer no longer supports IE8, so all supported browsers recognize HTML5. 
     790     */ 
     791    public function customize_preview_html5() { 
     792        _deprecated_function( __FUNCTION__, '4.7.0' ); 
    802793    } 
    803794 
  • trunk/src/wp-includes/js/customize-selective-refresh.js

    r37700 r38649  
    746746        var handleSettingChange, watchSettingChange, unwatchSettingChange; 
    747747 
    748         // Polyfill for IE8 to support the document.head attribute. 
    749         if ( ! document.head ) { 
    750             document.head = $( 'head:first' )[0]; 
    751         } 
    752  
    753748        _.extend( self.data, _customizePartialRefreshExports ); 
    754749 
  • 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.