changeset 51740:f79cfb07f13f

8209914: javadoc search sometimes generates bad URIs Reviewed-by: jjg
author hannesw
date Fri, 14 Sep 2018 14:45:31 +0200
parents 7bed934d439e
children ed9b1200dd81
files src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js
diffstat 1 files changed, 7 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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();
             }
         }
     });