diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-03-14 19:28:41 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-03-14 19:35:21 +0100 |
commit | c2781f5a1d81a3362035bde4d0d5d6f320a7bd16 (patch) | |
tree | a37b1fd5008f591a726ac4a70bc3be1369acde57 /src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js | |
parent | 66588a78f22aa3595df9938449268e432f27e3ff (diff) | |
download | scala-c2781f5a1d81a3362035bde4d0d5d6f320a7bd16.tar.gz scala-c2781f5a1d81a3362035bde4d0d5d6f320a7bd16.tar.bz2 scala-c2781f5a1d81a3362035bde4d0d5d6f320a7bd16.zip |
Change behavior of clear-button on input fields
This commit changes the behavior to only remove the "x" if there is no
input in the input field. The old behavior was to bind the blur event to
be fired later - but this had the drawback of not working properly on
fast hardware as the timeout would actually beat the click event.
Diffstat (limited to 'src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js')
-rw-r--r-- | src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js index ae39f83852..5f42dfa114 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js +++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js @@ -147,10 +147,10 @@ $(document).ready(function() { }); $("#memberfilter > .clear").click(function() { $("#memberfilter input").attr("value", ""); + $(this).hide(); filter(); }); $(document).keydown(function(event) { - if (event.keyCode == 9) { // tab $("#index-input", window.parent.document).focus(); input.attr("value", ""); @@ -162,8 +162,7 @@ $(document).ready(function() { if ($(this).hasClass("in")) { $(this).removeClass("in"); $(this).addClass("out"); - } - else if ($(this).hasClass("out")) { + } else if ($(this).hasClass("out")) { $(this).removeClass("out"); $(this).addClass("in"); } @@ -174,8 +173,7 @@ $(document).ready(function() { if ($(this).hasClass("in")) { $(this).removeClass("in"); $(this).addClass("out"); - } - else if ($(this).hasClass("out")) { + } else if ($(this).hasClass("out")) { $(this).removeClass("out"); $(this).addClass("in"); } @@ -307,14 +305,11 @@ $(document).ready(function() { exposeMember(jqElem); } - $("#mbrsel-input").on("focus", function() { - $("#memberfilter > .clear").show(); - }); - - $("#mbrsel-input").on("blur", function() { - setTimeout(function() { + $("#mbrsel-input").on("input", function() { + if ($(this).val().length > 0) + $("#memberfilter > .clear").show(); + else $("#memberfilter > .clear").hide(); - }, 10); }); }); |