8209914: javadoc search sometimes generates bad URIs
authorhannesw
Fri, 14 Sep 2018 14:45:31 +0200
changeset 51740 f79cfb07f13f
parent 51739 7bed934d439e
child 51741 ed9b1200dd81
8209914: javadoc search sometimes generates bad URIs Reviewed-by: jjg
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Fri Sep 14 14:24:00 2018 +0300
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Fri Sep 14 14:45:31 2018 +0200
@@ -132,24 +132,18 @@
         } else {
             label = item.l;
         }
-        $li = $("<li/>").appendTo(ul);
+        var li = $("<li/>").appendTo(ul);
         if (item.category === catSearchTags) {
             if (item.d) {
-                $("<a/>").attr("href", "#")
-                        .html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span><br><span class=\"searchTagDescResult\">"
-                                + item.d + "</span><br>")
-                        .appendTo($li);
+                li.html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span><br><span class=\"searchTagDescResult\">"
+                                + item.d + "</span><br>");
             } else {
-                $("<a/>").attr("href", "#")
-                        .html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span>")
-                        .appendTo($li);
+                li.html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span>");
             }
         } else {
-            $("<a/>").attr("href", "#")
-                    .html(label)
-                    .appendTo($li);
+            li.html(label);
         }
-        return $li;
+        return li;
     }
 });
 $(function() {
@@ -328,6 +322,7 @@
                 } else {
                     window.location.href = pathtoroot + url;
                 }
+                $("#search").focus();
             }
         }
     });