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
This commit is contained in:
parent
3f0f8d4a31
commit
41e53f4385
|
@ -4762,6 +4762,12 @@
|
||||||
*/
|
*/
|
||||||
populateChangesetUuidParam = function( isIncluded ) {
|
populateChangesetUuidParam = function( isIncluded ) {
|
||||||
var urlParser, queryParams;
|
var urlParser, queryParams;
|
||||||
|
|
||||||
|
// Abort on IE9 which doesn't support history management.
|
||||||
|
if ( ! history.replaceState ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
urlParser = document.createElement( 'a' );
|
urlParser = document.createElement( 'a' );
|
||||||
urlParser.href = location.href;
|
urlParser.href = location.href;
|
||||||
queryParams = api.utils.parseQueryString( urlParser.search.substr( 1 ) );
|
queryParams = api.utils.parseQueryString( urlParser.search.substr( 1 ) );
|
||||||
|
@ -4780,11 +4786,9 @@
|
||||||
history.replaceState( {}, document.title, urlParser.href );
|
history.replaceState( {}, document.title, urlParser.href );
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( history.replaceState ) {
|
changesetStatus.bind( function( newStatus ) {
|
||||||
changesetStatus.bind( function( newStatus ) {
|
populateChangesetUuidParam( '' !== newStatus && 'publish' !== newStatus );
|
||||||
populateChangesetUuidParam( '' !== newStatus && 'publish' !== newStatus );
|
} );
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Expose states to the API.
|
// Expose states to the API.
|
||||||
api.state = state;
|
api.state = state;
|
||||||
|
|
Loading…
Reference in New Issue