@@ -39,13 +39,7 @@ $( document ).delegate( "ul, ol", "listviewcreate", function() {
3939 e . preventDefault ( ) ;
4040 search . blur ( ) ;
4141 } ) ,
42- search = $ ( "<input>" , {
43- placeholder : listview . options . filterPlaceholder
44- } )
45- . attr ( "data-" + $ . mobile . ns + "type" , "search" )
46- . jqmData ( "lastval" , "" )
47- . bind ( "keyup change input" , function ( ) {
48-
42+ onKeyUp = function ( e ) {
4943 var $this = $ ( this ) ,
5044 val = this . value . toLowerCase ( ) ,
5145 listItems = null ,
@@ -57,6 +51,11 @@ $( document ).delegate( "ul, ol", "listviewcreate", function() {
5751 // Check if a custom filter callback applies
5852 isCustomFilterCallback = listview . options . filterCallback !== defaultFilterCallback ;
5953
54+ if ( lastval && lastval === val ) {
55+ // Execute the handler only once per value change
56+ return ;
57+ }
58+
6059 listview . _trigger ( "beforefilter" , "beforefilter" , { input : this } ) ;
6160
6261 // Change val as lastval for next execution
@@ -119,7 +118,13 @@ $( document ).delegate( "ul, ol", "listviewcreate", function() {
119118 listItems . toggleClass ( "ui-screen-hidden" , ! ! listview . options . filterReveal ) ;
120119 }
121120 listview . _addFirstLastClasses ( li , listview . _getVisibles ( li , false ) , false ) ;
121+ } ,
122+ search = $ ( "<input>" , {
123+ placeholder : listview . options . filterPlaceholder
122124 } )
125+ . attr ( "data-" + $ . mobile . ns + "type" , "search" )
126+ . jqmData ( "lastval" , "" )
127+ . bind ( "keyup change input" , onKeyUp )
123128 . appendTo ( wrapper )
124129 . textinput ( ) ;
125130
0 commit comments