Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixing mousover to work with list items with child elements

Signed-off-by: Rein Henrichs <reinh@reinh.com>
  • Loading branch information...
commit 8eabe8161d5df792b4f8f7fdeacaa0ac11f4de16 1 parent 0dbe56a
Rein Henrichs authored January 07, 2008
8  jquery.ui.autocomplete.ext.js
... ...
@@ -1,11 +1,13 @@
1 1
 /*
2  
- * UI Autocomplete - jQuery plugin 0.0.1
3  
- *
4  
- * Copyright (c) 2007 Yehuda Katz, Rein Henrichs
  2
+ * jQuery UI Autocomplete
  3
+ * version: 1.0 (1/2/2008)
  4
+ * @requires: jQuery v1.2 or later, dimensions plugin
5 5
  *
6 6
  * Dual licensed under the MIT and GPL licenses:
7 7
  *   http://www.opensource.org/licenses/mit-license.php
8 8
  *   http://www.gnu.org/licenses/gpl.html
  9
+ *
  10
+ * Copyright 2007 Yehuda Katz, Rein Henrichs
9 11
  */
10 12
 
11 13
 (function($) {
24  jquery.ui.autocomplete.js
... ...
@@ -1,12 +1,26 @@
1  
-/*
2  
- * UI Autocomplete - jQuery plugin 0.0.1
3  
- *
4  
- * Copyright (c) 2007 Yehuda Katz, Rein Henrichs
  1
+/* jQuery Autocomplete
  2
+ * Version 1.0
  3
+ * Written by Yehuda Katz (wycats@gmail.com) and Rein Henrichs (reinh@reinh.com)
  4
+ * @requires jQuery v1.2, jQuery dimensions plugin
5 5
  *
  6
+ * Copyright 2007 Yehuda Katz, Rein Henrichs
6 7
  * Dual licensed under the MIT and GPL licenses:
7 8
  *   http://www.opensource.org/licenses/mit-license.php
8 9
  *   http://www.gnu.org/licenses/gpl.html
  10
+ *
  11
+ */
  12
+
  13
+/*
  14
+ * @description Form autocomplete plugin using preloaded or Ajax JSON data source 
  15
+ *
  16
+ * @example $('input#user-name').autocomplete({list: ["quentin", "adam", "admin"]})
  17
+ * @desc Simple autocomplete with basic JSON data source
  18
+ *
  19
+ * @example $('input#user-name').autocomplete({ajax: "/usernames.js"})
  20
+ * @desc Simple autocomplete with Ajax loaded JSON data source
  21
+ *
9 22
  */
  23
+ 
10 24
 
11 25
 (function($) {
12 26
   
@@ -45,7 +59,7 @@
45 59
       // If you hover over the container, but not its children, return
46 60
       if(e.target == container[0]) return;
47 61
       // Set the selected item to the item hovered over and make it active
48  
-      selected = $("> *", container).index(e.target); select();
  62
+      selected = $("> *", container).index($(e.target).is('li') ? e.target : $(e.target).parents('li')[0]); select();
49 63
     }).bind("click.autocomplete", function(e) {
50 64
       $("body").trigger("activate.autocomplete"); $.data(document.body, "suppressKey", false); 
51 65
     });

0 notes on commit 8eabe81

Please sign in to comment.
Something went wrong with that request. Please try again.