WordPress.org

Make WordPress Core

Changeset 39574


Ignore:
Timestamp:
12/12/16 02:10:30 (8 months ago)
Author:
dd32
Message:

Customize: Allow (optional) url parameter to be omitted in intercepted calls to history.pushState() and history.replaceState() in customize preview.

Fixes issue where calls without the url parameter erroneously end up rewriting the location path to /undefined.

Props Christian1012, westonruter.
Merges [39547] to the 4.7 branch.
Fixes #39175.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/js/customize-preview.js

    r39345 r39574  
    5050            return function historyReplaceState( data, title, url ) { 
    5151                currentHistoryState = data; 
    52                 return nativeReplaceState.call( history, data, title, injectUrlWithState( url ) ); 
     52                return nativeReplaceState.call( history, data, title, 'string' === typeof url && url.length > 0 ? injectUrlWithState( url ) : url ); 
    5353            }; 
    5454        } )( history.replaceState ); 
     
    5757            return function historyPushState( data, title, url ) { 
    5858                currentHistoryState = data; 
    59                 return nativePushState.call( history, data, title, injectUrlWithState( url ) ); 
     59                return nativePushState.call( history, data, title, 'string' === typeof url && url.length > 0 ? injectUrlWithState( url ) : url ); 
    6060            }; 
    6161        } )( history.pushState ); 
Note: See TracChangeset for help on using the changeset viewer.