WordPress.org

Make WordPress Core

Ticket #40658: 40658.0.diff

File 40658.0.diff, 1.2 KB (added by westonruter, 3 years ago)
  • src/wp-includes/js/customize-selective-refresh.js

    diff --git src/wp-includes/js/customize-selective-refresh.js src/wp-includes/js/customize-selective-refresh.js
    index 4f7165656a..2e0b5edb64 100644
    wp.customize.selectiveRefresh = ( function( $, api ) { 
    398398                 * @returns {boolean} Whether the rendering was successful and the fallback was not invoked.
    399399                 */
    400400                renderContent: function( placement ) {
    401                         var partial = this, content, newContainerElement;
     401                        var partial = this, content, newContainerElement, contentWithoutConditionalComments;
    402402                        if ( ! placement.container ) {
    403403                                partial.fallback( new Error( 'no_container' ), [ placement ] );
    404404                                return false;
    wp.customize.selectiveRefresh = ( function( $, api ) { 
    415415                                return false;
    416416                        }
    417417
     418                        contentWithoutConditionalComments = placement.addedContent.replace( /<!--\[if.+?]>(.|\n)+<!\[endif]-->/ig, '' );
     419                        if ( /<script.*?>/i.test( contentWithoutConditionalComments ) ) {
     420                                partial.fallback( new Error( 'script_content' ), [ placement ] );
     421                                return false;
     422                        }
     423
    418424                        /* jshint ignore:start */
    419425                        self.orginalDocumentWrite = document.write;
    420426                        document.write = function() {