Sha256: 7043b0c9a96d1a760053d3615b1e83e3106c8760559ce32326607a3b17204911
Contents?: true
Size: 1.04 KB
Versions: 56
Compression:
Stored size: 1.04 KB
Contents
/* * jQuery UI Autocomplete HTML Extension * * Copyright 2010, Scott González (http://scottgonzalez.com) * Dual licensed under the MIT or GPL Version 2 licenses. * * http://github.com/scottgonzalez/jquery-ui-extensions */ (function( $ ) { var proto = $.ui.autocomplete.prototype, initSource = proto._initSource; function filter( array, term ) { var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" ); return $.grep( array, function(value) { return matcher.test( $( "<div>" ).html( value.label || value.value || value ).text() ); }); } $.extend( proto, { _initSource: function() { if ( this.options.html && $.isArray(this.options.source) ) { this.source = function( request, response ) { response( filter( this.options.source, request.term ) ); }; } else { initSource.call( this ); } }, _renderItem: function( ul, item) { return $( "<li></li>" ) .data( "item.autocomplete", item ) .append( $( "<a></a>" )[ this.options.html ? "html" : "text" ]( item.label ) ) .appendTo( ul ); } }); })( jQuery );
Version data entries
56 entries across 56 versions & 1 rubygems