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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-04-10 21:15:41 +00:00
parent 9354ea683f
commit 226e34effc
3 changed files with 11 additions and 7 deletions

View File

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

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-40404';
$wp_version = '4.8-alpha-40405';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.