From 41e53f4385f3461639d39b213a45a9827da9a5bc Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 13 Apr 2017 12:31:23 +0000 Subject: [PATCH] Customize: Verify availability of `history.replaceState` (in IE9) before attempting to populate `changeset_uuid` parameter. Props westonruter, timmydcrawford for testing. Amends [39686]. See #39227. Fixes #40405. Merges[40405] to the 4.7 branch. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40420 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/customize-controls.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index e038dcc8fa..d340a1ba04 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -4762,6 +4762,12 @@ */ populateChangesetUuidParam = function( isIncluded ) { var urlParser, queryParams; + + // Abort on IE9 which doesn't support history management. + if ( ! history.replaceState ) { + return; + } + urlParser = document.createElement( 'a' ); urlParser.href = location.href; queryParams = api.utils.parseQueryString( urlParser.search.substr( 1 ) ); @@ -4780,11 +4786,9 @@ history.replaceState( {}, document.title, urlParser.href ); }; - if ( history.replaceState ) { - changesetStatus.bind( function( newStatus ) { - populateChangesetUuidParam( '' !== newStatus && 'publish' !== newStatus ); - } ); - } + changesetStatus.bind( function( newStatus ) { + populateChangesetUuidParam( '' !== newStatus && 'publish' !== newStatus ); + } ); // Expose states to the API. api.state = state;