]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/customize-preview.js
WordPress 4.7.1
[autoinstalls/wordpress.git] / wp-includes / js / customize-preview.js
index a4cb196dc10fbd287a7f8db1c3bcc5f448674ed4..f51c45ff98d3f77c8649810278b86702e661c88b 100644 (file)
                history.replaceState = ( function( nativeReplaceState ) {
                        return function historyReplaceState( data, title, url ) {
                                currentHistoryState = data;
-                               return nativeReplaceState.call( history, data, title, injectUrlWithState( url ) );
+                               return nativeReplaceState.call( history, data, title, 'string' === typeof url && url.length > 0 ? injectUrlWithState( url ) : url );
                        };
                } )( history.replaceState );
 
                history.pushState = ( function( nativePushState ) {
                        return function historyPushState( data, title, url ) {
                                currentHistoryState = data;
-                               return nativePushState.call( history, data, title, injectUrlWithState( url ) );
+                               return nativePushState.call( history, data, title, 'string' === typeof url && url.length > 0 ? injectUrlWithState( url ) : url );
                        };
                } )( history.pushState );
 
                 */
                handleLinkClick: function( event ) {
                        var preview = this, link, isInternalJumpLink;
-                       link = $( event.target );
+                       link = $( event.target ).closest( 'a' );
 
                        // No-op if the anchor is not a link.
                        if ( _.isUndefined( link.attr( 'href' ) ) ) {