From 966fca980f0d61aea0f00667eef7f93776192b64 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 27 Mar 2017 06:20:19 +0000 Subject: [PATCH] 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. Merges [40318] to the 4.7 branch. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40335 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/customize-preview.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/js/customize-preview.js b/src/wp-includes/js/customize-preview.js index d95f804bcd..7b8804d3ed 100644 --- a/src/wp-includes/js/customize-preview.js +++ b/src/wp-includes/js/customize-preview.js @@ -273,7 +273,7 @@ * @returns {boolean} Is appropriate for changeset link. */ api.isLinkPreviewable = function isLinkPreviewable( element, options ) { - var matchesAllowedUrl, parsedAllowedUrl, args; + var matchesAllowedUrl, parsedAllowedUrl, args, elementHost; args = _.extend( {}, { allowAdminAjax: false }, options || {} ); @@ -286,10 +286,11 @@ return false; } + elementHost = element.host.replace( /:80$/, '' ); parsedAllowedUrl = document.createElement( 'a' ); matchesAllowedUrl = ! _.isUndefined( _.find( api.settings.url.allowed, function( allowedUrl ) { parsedAllowedUrl.href = allowedUrl; - return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host === element.host && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) ); + return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host.replace( /:80$/, '' ) === elementHost && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) ); } ) ); if ( ! matchesAllowedUrl ) { return false;