Browse Source

Don't mutate window.location.hash when updating querystring

Matt Meshulam 8 years ago
parent
commit
c20b505f0c
1 changed files with 2 additions and 3 deletions
  1. 2 3
      examples/index.html

+ 2 - 3
examples/index.html

@@ -379,11 +379,10 @@
 
 			var v = filterInput.value;
 			if( v !== '' ) {
-				window.history.replaceState( {} , '', '?q=' + v );
+				window.history.replaceState( {} , '', '?q=' + v + window.location.hash );
 			} else {
-				window.history.replaceState( {} , '', window.location.pathname );
+				window.history.replaceState( {} , '', window.location.pathname + window.location.hash );
 			}
-			if( selected ) window.location.hash = selected;
 
 			var exp = new RegExp( v, 'gi' );