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. git-svn-id: https://develop.svn.wordpress.org/trunk@40318 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
df23b65221
commit
0cd74be18a
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue