From 1b9c964e8138dbe7d8b3a8463a6cdbebf14a0acc Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 10 Apr 2017 21:14:50 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@40405 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;