2
0
Эх сурвалжийг харах

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

Matt Meshulam 8 жил өмнө
parent
commit
c20b505f0c
1 өөрчлөгдсөн 2 нэмэгдсэн , 3 устгасан
  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' );