Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit afe6630

Browse files
committed
try/catch the regexp, fixes 2416
1 parent 265ffb6 commit afe6630

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

js/jquery.mobile.listview.filter.js

100644100755
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@ $( ":jqmData(role='listview')" ).live( "listviewcreate", function() {
4040
lastval = $this.jqmData( "lastval" ) + "",
4141
childItems = false,
4242
itemtext = "",
43-
item, change;
43+
item, change,
44+
regex = "";
45+
46+
try {
47+
regex = new RegExp( "^" + lastval );
48+
} catch (e) {}
4449

4550
// Change val as lastval for next execution
4651
$this.jqmData( "lastval" , val );
47-
48-
change = val.replace( new RegExp( "^" + lastval ) , "" );
52+
change = val.replace( regex , "" );
4953

5054
if ( val.length < lastval.length || change.length != ( val.length - lastval.length ) ) {
5155

0 commit comments

Comments
 (0)