// events when we know the keydown event was used to modify the
// search term. #7799
var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
- nodeName = this.element[0].nodeName.toLowerCase(),
+ nodeName = this.element[ 0 ].nodeName.toLowerCase(),
isTextarea = nodeName === "textarea",
isInput = nodeName === "input";
previous = this.previous;
// only trigger when focus was lost (click on menu)
- if ( this.element[0] !== this.document[0].activeElement ) {
+ if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) {
this.element.focus();
this.previous = previous;
// #6109 - IE triggers two focus events and the second
}
if ( !element.length ) {
- element = this.document[0].body;
+ element = this.document[ 0 ].body;
}
return element;
_initSource: function() {
var array, url,
that = this;
- if ( $.isArray(this.options.source) ) {
+ if ( $.isArray( this.options.source ) ) {
array = this.options.source;
this.source = function( request, response ) {
response( $.ui.autocomplete.filter( array, request.term ) );
response( data );
},
error: function() {
- response( [] );
+ response([]);
}
});
};
_normalize: function( items ) {
// assume all items have the right format when the first item is complete
- if ( items.length && items[0].label && items[0].value ) {
+ if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
return items;
}
return $.map( items, function( item ) {
this._resizeMenu();
ul.position( $.extend({
of: this.element
- }, this.options.position ));
+ }, this.options.position ) );
if ( this.options.autoFocus ) {
this.menu.next();
$.extend( $.ui.autocomplete, {
escapeRegex: function( value ) {
- return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
+ return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
},
- filter: function(array, term) {
- var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
- return $.grep( array, function(value) {
+ filter: function( array, term ) {
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
+ return $.grep( array, function( value ) {
return matcher.test( value.label || value.value || value );
});
}