Make WordPress Core

Changeset 40318


Ignore:
Timestamp:
03/23/2017 05:24:08 PM (8 years ago)
Author:
westonruter
Message:

Customize: Fix navigation of site in preview on IE11.

Addresses issue in IE11 where the default port number of :80 is unexpectedly included on link.host for links dynamically created by scripts.

Props westonruter, afercia for testing.
See #38409.
Fixes #40198.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/customize-preview.js

    r40064 r40318  
    274274     */
    275275    api.isLinkPreviewable = function isLinkPreviewable( element, options ) {
    276         var matchesAllowedUrl, parsedAllowedUrl, args;
     276        var matchesAllowedUrl, parsedAllowedUrl, args, elementHost;
    277277
    278278        args = _.extend( {}, { allowAdminAjax: false }, options || {} );
     
    287287        }
    288288
     289        elementHost = element.host.replace( /:80$/, '' );
    289290        parsedAllowedUrl = document.createElement( 'a' );
    290291        matchesAllowedUrl = ! _.isUndefined( _.find( api.settings.url.allowed, function( allowedUrl ) {
    291292            parsedAllowedUrl.href = allowedUrl;
    292             return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host === element.host && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) );
     293            return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host.replace( /:80$/, '' ) === elementHost && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) );
    293294        } ) );
    294295        if ( ! matchesAllowedUrl ) {
Note: See TracChangeset for help on using the changeset viewer.