Skip to content
This repository was archived by the owner on Aug 15, 2019. It is now read-only.

Commit 336a200

Browse files
committed
#253 - Fixing delimiter check on keypress event. Updated jquery to 2.1.3 in example.html. Version bump to 1.3.4
1 parent 55c2917 commit 336a200

File tree

5 files changed

+23
-18
lines changed

5 files changed

+23
-18
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery.tagsinput",
3-
"version": "1.3.3",
3+
"version": "1.3.4",
44
"main": ["src/jquery.tagsinput.js", "src/jquery.tagsinput.css"],
55
"ignore": [
66
"**/.*",

dist/jquery.tagsinput.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
<link rel="stylesheet" type="text/css" href="./src/jquery.tagsinput.css" />
3-
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
3+
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
44
<script type="text/javascript" src="./src/jquery.tagsinput.js"></script>
55
<!-- To test using the original jQuery.autocomplete, uncomment the following -->
66
<!--

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jQuery-Tags-Input",
3-
"version": "1.3.3",
3+
"version": "1.3.4",
44
"description": "",
55
"main": "jquery.tagsinput.js",
66
"directories": {

src/jquery.tagsinput.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -353,25 +353,30 @@
353353
}
354354
};
355355

356-
/**
356+
/**
357357
* check delimiter Array
358358
* @param event
359359
* @returns {boolean}
360360
* @private
361361
*/
362-
var _checkDelimiter = function(event){
363-
var flag = false;// defalut no match
364-
365-
if(event.which == 13){// Enter
366-
flag = true;
367-
}
368-
369-
$.each(event.data.delimiter ,function(index, value){
370-
if(event.which == value.charCodeAt(0)){
371-
flag = true;
362+
var _checkDelimiter = function(event){
363+
var found = false;
364+
if (event.which == 13) {
365+
return true;
366+
}
367+
368+
if (typeof event.data.delimiter === 'string') {
369+
if (event.which == event.data.delimiter.charCodeAt(0)) {
370+
found = true;
371+
}
372+
} else {
373+
$.each(event.data.delimiter, function(index, delimiter) {
374+
if (event.which == delimiter.charCodeAt(0)) {
375+
found = true;
372376
}
373-
});
377+
});
378+
}
374379

375-
return flag;
376-
}
380+
return found;
381+
}
377382
})(jQuery);

0 commit comments

Comments
 (0)