]> git.lizzy.rs Git - rust.git/commitdiff
Fix anchor invalid redirection to search
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 12 May 2017 13:31:43 +0000 (15:31 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 12 May 2017 21:09:25 +0000 (23:09 +0200)
src/librustdoc/html/static/main.js

index fbc7615588eed2fe4b820a9d5e30ffe43e2c9e8c..c115a6ccba609b3b0788dc2e9a6e288090985a0f 100644 (file)
                         if (hasClass(main, 'content')) {
                             removeClass(main, 'hidden');
                         }
-                        var search = document.getElementById('search');
-                        if (hasClass(main, 'content')) {
-                            addClass(main, 'hidden');
+                        var search_c = document.getElementById('search');
+                        if (hasClass(search_c, 'content')) {
+                            addClass(search_c, 'hidden');
                         }
                     }
                     // Revert to the previous title manually since the History
                     // perform the search. This will empty the bar if there's
                     // nothing there, which lets you really go back to a
                     // previous state with nothing in the bar.
-                    document.getElementsByClassName('search-input')[0].value = params.search;
+                    if (params.search) {
+                        document.getElementsByClassName('search-input')[0].value = params.search;
+                    } else {
+                        document.getElementsByClassName('search-input')[0].value = '';
+                    }
                     // Some browsers fire 'onpopstate' for every page load
                     // (Chrome), while others fire the event only when actually
                     // popping a state (Firefox), which is why search() is