Procházet zdrojové kódy

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

Matt Meshulam před 8 roky
rodič
revize
c20b505f0c
1 změnil soubory, kde provedl 2 přidání a 3 odebrání
  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' );