Skip to content

Commit f0c203a

Browse files
committed
Autocomplete demo: Combobox cleanup.
1 parent ca88fc1 commit f0c203a

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

demos/autocomplete/combobox.html

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
bottom: 0;
2525
margin-left: -1px;
2626
padding: 0;
27-
/* adjust styles for IE 6/7 */
27+
/* support: IE7 */
2828
*height: 1.7em;
2929
*top: 0.1em;
3030
}
@@ -46,7 +46,7 @@
4646
.addClass( "ui-combobox" )
4747
.insertAfter( select );
4848

49-
function removeIfInvalid(element) {
49+
function removeIfInvalid( element ) {
5050
var value = $( element ).val(),
5151
matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( value ) + "$", "i" ),
5252
valid = false;
@@ -56,6 +56,7 @@
5656
return false;
5757
}
5858
});
59+
5960
if ( !valid ) {
6061
// remove invalid value, as it didn't match anything
6162
$( element )
@@ -66,8 +67,7 @@
6667
setTimeout(function() {
6768
input.tooltip( "close" ).attr( "title", "" );
6869
}, 2500 );
69-
input.data( "autocomplete" ).term = "";
70-
return false;
70+
input.data( "ui-autocomplete" ).term = "";
7171
}
7272
}
7373

@@ -103,13 +103,14 @@
103103
});
104104
},
105105
change: function( event, ui ) {
106-
if ( !ui.item )
107-
return removeIfInvalid( this );
106+
if ( !ui.item ) {
107+
removeIfInvalid( this );
108+
}
108109
}
109110
})
110111
.addClass( "ui-widget ui-widget-content ui-corner-left" );
111112

112-
input.data( "autocomplete" )._renderItem = function( ul, item ) {
113+
input.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
113114
return $( "<li>" )
114115
.append( "<a>" + item.label + "</a>" )
115116
.appendTo( ul );
@@ -144,19 +145,14 @@
144145
input.focus();
145146
});
146147

147-
input
148-
.tooltip({
149-
position: {
150-
of: this.button
151-
},
152-
tooltipClass: "ui-state-highlight"
153-
});
148+
input.tooltip({
149+
tooltipClass: "ui-state-highlight"
150+
});
154151
},
155152

156-
destroy: function() {
153+
_destroy: function() {
157154
this.wrapper.remove();
158155
this.element.show();
159-
$.Widget.prototype.destroy.call( this );
160156
}
161157
});
162158
})( jQuery );

0 commit comments

Comments
 (0)