Skip to content

Commit 471b28d

Browse files
committed
Fixed #133
1 parent 61a9843 commit 471b28d

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

public/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ <h4><a href="./demo.html">view more advanced demos and customization →</a></h4
569569
</div>
570570

571571
<div class="item">
572-
<select class="customOptions">
572+
<select class="custom-options">
573573
<option value="">Select with icons</option>
574574
<option value="firefox">Firefox</option>
575575
<option value="chrome">Chrome</option>
@@ -580,7 +580,7 @@ <h4><a href="./demo.html">view more advanced demos and customization →</a></h4
580580
</div>
581581

582582
<div class="item">
583-
<select class="customLabel">
583+
<select class="custom-label">
584584
<option value="">Select with custom label builder</option>
585585
<option value="ant">Ant</option>
586586
<option value="bird">Bird</option>
@@ -692,13 +692,13 @@ <h4><a href="./demo.html">view more advanced demos and customization →</a></h4
692692
<script src="jquery.selectric.js"></script>
693693
<script>
694694
$(function() {
695-
$('.customOptions').selectric({
695+
$('.custom-options').selectric({
696696
optionsItemBuilder: function(itemData) {
697697
return itemData.value.length ? '<span class="ico ico-' + itemData.value + '"></span>' + itemData.text : itemData.text;
698698
}
699699
});
700700

701-
$('.customLabel').selectric({
701+
$('.custom-label').selectric({
702702
labelBuilder: function(currItem) {
703703
return '<strong><em>' + currItem.text + '</em></strong>';
704704
}

public/jquery.selectric.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* /,'
1010
* /'
1111
*
12-
* Selectric ϟ v1.11.0 (Sep 29 2016) - http://lcdsantos.github.io/jQuery-Selectric/
12+
* Selectric ϟ v1.11.0 (Oct 06 2016) - http://lcdsantos.github.io/jQuery-Selectric/
1313
*
1414
* Copyright (c) 2016 Leonardo Santos; MIT License
1515
*
@@ -633,6 +633,7 @@
633633
})
634634
.on('input propertychange', function() {
635635
var val = _this.elements.input.val();
636+
var searchRegExp = new RegExp('^' + _this.utils.escapeRegExp(val), 'i');
636637

637638
// Clear search
638639
clearTimeout(_this.resetStr);
@@ -643,9 +644,9 @@
643644
if ( val.length ) {
644645
// Search in select options
645646
$.each(_this.items, function(i, elm) {
646-
if ( new RegExp('^' + _this.utils.escapeRegExp(val), 'i').test(elm.slug) && !elm.disabled ) {
647+
if ( !elm.disabled && searchRegExp.test(elm.text) || searchRegExp.test(elm.slug) ) {
647648
_this.highlight(i);
648-
return false;
649+
return;
649650
}
650651
});
651652
}

0 commit comments

Comments
 (0)