Skip to content

Commit

Permalink
Merge pull request #46 from huei90/patch-1
Browse files Browse the repository at this point in the history
ie 8 compatibility, replace indexOf method
  • Loading branch information
timschlechter committed Oct 30, 2013
2 parents 090aa87 + 70d76a2 commit cf0b5e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bootstrap-tagsinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
if (item) {
$('.tag', self.$container).filter(function() { return $(this).data('item') === item; }).remove();
$('option', self.$element).filter(function() { return $(this).data('item') === item; }).remove();
self.itemsArray.splice(self.itemsArray.indexOf(item), 1);
self.itemsArray.splice($.inArray(item, self.itemsArray), 1);
}

if (!dontPushVal)
Expand Down Expand Up @@ -275,7 +275,7 @@
self.add(this.map[text]);
},
matcher: function (text) {
return (text.toLowerCase().indexOf(this.query.trim().toLowerCase()) !== -1);
return ($.inArray(this.query.trim().toLowerCase(), text.toLowerCase()) !== -1);
},
sorter: function (texts) {
return texts.sort();
Expand Down Expand Up @@ -337,7 +337,7 @@
default:
// When key corresponds one of the confirmKeys, add current input
// as a new tag
if (self.options.freeInput && self.options.confirmKeys.indexOf(event.which) >= 0) {
if (self.options.freeInput && $.inArray(event.which, self.options.confirmKeys) >= 0) {
self.add($input.val());
$input.val('');
event.preventDefault();
Expand Down

0 comments on commit cf0b5e6

Please sign in to comment.