WordPress.org

Make WordPress Core

Changeset 40386


Ignore:
Timestamp:
04/06/17 17:32:17 (6 months ago)
Author:
swissspidy
Message:

Customize: Fix HTTPS navigation of site in preview on IE11.

Accounts for HTTPS links (port 443) where [40318] only accounted for HTTP links (port 80). Addresses issue in IE11 where the default port number is unexpectedly included on link.host for links dynamically created by scripts.

Props mattwiebe.
Amends [40318], [38890].
See #38409.
Fixes #40198.

Merges [40381] to the 4.7 branch.

Location:
branches/4.7
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/js/customize-base.js

    r39051 r40386  
    656656                urlParser.href = to; 
    657657                // Port stripping needed by IE since it adds to host but not to event.origin. 
    658                 return urlParser.protocol + '//' + urlParser.host.replace( /:80$/, '' ); 
     658                return urlParser.protocol + '//' + urlParser.host.replace( /:(80|443)$/, '' ); 
    659659            }); 
    660660 
  • branches/4.7/src/wp-includes/js/customize-preview.js

    r40335 r40386  
    287287        } 
    288288 
    289         elementHost = element.host.replace( /:80$/, '' ); 
     289        elementHost = element.host.replace( /:(80|443)$/, '' ); 
    290290        parsedAllowedUrl = document.createElement( 'a' ); 
    291291        matchesAllowedUrl = ! _.isUndefined( _.find( api.settings.url.allowed, function( allowedUrl ) { 
    292292            parsedAllowedUrl.href = allowedUrl; 
    293             return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host.replace( /:80$/, '' ) === elementHost && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) ); 
     293            return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host.replace( /:(80|443)$/, '' ) === elementHost && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) ); 
    294294        } ) ); 
    295295        if ( ! matchesAllowedUrl ) { 
Note: See TracChangeset for help on using the changeset viewer.