summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-02-08 01:31:10 +0000
committerScott González <scott.gonzalez@gmail.com>2010-02-08 01:31:10 +0000
commit925bf9ec35905e260b7cfc7684de0c6465f91720 (patch)
tree7267ca95a7e1b7b3f8c06a8e865bc396b04735df
parent1402650134da47f48f6631b98b102f499936c752 (diff)
downloadjquery-ui-925bf9ec35905e260b7cfc7684de0c6465f91720.tar.gz
jquery-ui-925bf9ec35905e260b7cfc7684de0c6465f91720.zip
Autocomplete: Split out logic for rendering individual items.
-rw-r--r--ui/jquery.ui.autocomplete.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index c6d2e5578..78ac1f8b5 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -235,12 +235,10 @@ $.widget( "ui.autocomplete", {
},
_suggest: function( items ) {
- var ul = this.menu.element.empty();
+ var self = this,
+ ul = this.menu.element.empty();
$.each( items, function( index, item ) {
- $( "<li></li>" )
- .data( "item.autocomplete", item )
- .append( "<a>" + item.label + "</a>" )
- .appendTo( ul );
+ self._renderItem( ul, item );
});
this.menu.refresh();
this.menu.element.show();
@@ -249,6 +247,13 @@ $.widget( "ui.autocomplete", {
}
},
+ _renderItem: function( ul, item) {
+ return $( "<li></li>" )
+ .data( "item.autocomplete", item )
+ .append( "<a>" + item.label + "</a>" )
+ .appendTo( ul );
+ },
+
_move: function( direction, event ) {
if ( !this.menu.element.is(":visible") ) {
this.search( null, event );