summaryrefslogtreecommitdiff
path: root/Makefile.d/bootstrap-typeahead.js.patch
blob: dfbab80bce560c253530298a91e9be9d94a171eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
commit f3e23371fa0473c82c28932e85570d94e5fc232a
Author: Dan McGee <dan@archlinux.org>
Date:   Mon Sep 24 20:21:15 2012 -0500

    Don't auto-select the first item in typeahead
    
    This assumption was baked into the Twitter bootstrap JS; kill it so it
    is still easy to do a freeform search if wanted.
    
    Signed-off-by: Dan McGee <dan@archlinux.org>

diff --git a/sitestatic/bootstrap-typeahead.js b/sitestatic/bootstrap-typeahead.js
index c2ccdea..3d355ae 100644
--- a/sitestatic/bootstrap-typeahead.js
+++ b/sitestatic/bootstrap-typeahead.js
@@ -45,9 +45,11 @@
 
   , select: function () {
       var val = this.$menu.find('.active').attr('data-value')
-      this.$element
-        .val(this.updater(val))
-        .change()
+      if (val) {
+        this.$element
+          .val(this.updater(val))
+          .change()
+      }
       return this.hide()
     }
 
@@ -141,7 +143,6 @@
         return i[0]
       })
 
-      items.first().addClass('active')
       this.$menu.html(items)
       return this
     }