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.

Built from https://develop.svn.wordpress.org/trunk@40318


git-svn-id: http://core.svn.wordpress.org/trunk@40225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-03-23 17:25:43 +00:00
parent 6b5169739f
commit 5aec57b209
3 changed files with 5 additions and 4 deletions

View File

@ -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;

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-40317';
$wp_version = '4.8-alpha-40318';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.