8147881: Javadoc search box watermark text issue
authorbpatel
Wed, 07 Jun 2017 22:58:37 -0700
changeset 45496 b41095adfdfd
parent 45420 036dbf8b3817
child 45497 cdf29c5063f8
8147881: Javadoc search box watermark text issue Reviewed-by: jjg, ksrini
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js
langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Wed Jul 05 23:37:13 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Wed Jun 07 22:58:37 2017 -0700
@@ -86,7 +86,7 @@
             $(this).val(watermark).addClass('watermark');
         }
     });
-    $("#search").keydown(function() {
+    $("#search").on('click keydown', function() {
         if ($(this).val() == watermark) {
             $(this).val('').removeClass('watermark');
         }
--- a/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java	Wed Jul 05 23:37:13 2017 +0200
+++ b/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java	Wed Jun 07 22:58:37 2017 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218
+ * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881
  * @summary Test the search feature of javadoc.
  * @author bpatel
  * @library ../lib
@@ -491,6 +491,11 @@
                 "function nestedName(e) {",
                 "function sortAndConcatResults(a1, a2) {",
                 "if (exactMatcher.test(item.l)) {\n"
-                + "                        presult.unshift(item);");
+                + "                        presult.unshift(item);",
+                "$(\"#search\").on('click keydown', function() {\n"
+                + "        if ($(this).val() == watermark) {\n"
+                + "            $(this).val('').removeClass('watermark');\n"
+                + "        }\n"
+                + "    });");
     }
 }