Browse Source

Fix chrome issue with search greedily using history.replaceState, fixes #364

Jordi Boggiano 11 years ago
parent
commit
1539684360
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/Packagist/WebBundle/Resources/public/js/search.js

+ 6 - 6
src/Packagist/WebBundle/Resources/public/js/search.js

@@ -41,6 +41,12 @@
             return;
         }
 
+        currentQuery = form.serialize();
+
+        if (previousQuery === currentQuery) {
+            return;
+        }
+
         if (window.history.pushState) {
             if (previousQuery === undefined) {
                 window.history.pushState(null, "Search", "/search/?q=" + $('input[type="search"]', form).val());
@@ -49,12 +55,6 @@
             }
         }
 
-        currentQuery = form.serialize();
-
-        if (previousQuery === currentQuery) {
-            return;
-        }
-
         $.ajax({
             url: form.attr('action'),
             data: currentQuery,