Skip to content

Commit acb48e6

Browse files
committed
Released 0.8.2.
1 parent e91258d commit acb48e6

16 files changed

+78
-46
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "selectize",
33
"keywords": ["select", "ui", "form", "input", "control", "autocomplete", "tagging", "tag"],
44
"description": "Selectize is a jQuery-based custom <select> UI control. Useful for tagging, contact lists, country selectors, etc.",
5-
"version": "0.8.1",
5+
"version": "0.8.2",
66
"license": "Apache License, Version 2.0",
77
"readmeFilename": "README.md",
88
"repository": {

dist/css/selectize.bootstrap2.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.bootstrap2.css (v0.8.1) - Bootstrap 2 Theme
2+
* selectize.bootstrap2.css (v0.8.2) - Bootstrap 2 Theme
33
* Copyright (c) 2013 Brian Reavis & contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this

dist/css/selectize.bootstrap3.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.bootstrap3.css (v0.8.1) - Bootstrap 3 Theme
2+
* selectize.bootstrap3.css (v0.8.2) - Bootstrap 3 Theme
33
* Copyright (c) 2013 Brian Reavis & contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this

dist/css/selectize.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.css (v0.8.1)
2+
* selectize.css (v0.8.2)
33
* Copyright (c) 2013 Brian Reavis & contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this

dist/css/selectize.default.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.default.css (v0.8.1) - Default Theme
2+
* selectize.default.css (v0.8.2) - Default Theme
33
* Copyright (c) 2013 Brian Reavis & contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this

dist/css/selectize.legacy.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.legacy.css (v0.8.1) - Default Theme
2+
* selectize.legacy.css (v0.8.2) - Default Theme
33
* Copyright (c) 2013 Brian Reavis & contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this

dist/js/selectize.js

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.js (v0.8.1)
2+
* selectize.js (v0.8.2)
33
* Copyright (c) 2013 Brian Reavis & contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -157,6 +157,16 @@
157157
.replace(/"/g, '&quot;');
158158
};
159159

160+
/**
161+
* Escapes "$" characters in replacement strings.
162+
*
163+
* @param {string} str
164+
* @returns {string}
165+
*/
166+
var escape_replace = function(str) {
167+
return (str + '').replace(/\$/g, '$$$$');
168+
};
169+
160170
var hook = {};
161171

162172
/**
@@ -458,7 +468,7 @@
458468
highlightedValue : null,
459469
isOpen : false,
460470
isDisabled : false,
461-
isRequired : $input.is(':required'),
471+
isRequired : $input.is('[required]'),
462472
isInvalid : false,
463473
isLocked : false,
464474
isFocused : false,
@@ -834,7 +844,7 @@
834844
}
835845
break;
836846
case KEY_ESC:
837-
self.blur();
847+
self.close();
838848
return;
839849
case KEY_DOWN:
840850
if (!self.isOpen && self.hasOptions) {
@@ -933,7 +943,7 @@
933943
self.isFocused = true;
934944
if (self.isDisabled) {
935945
self.blur();
936-
e.preventDefault();
946+
e && e.preventDefault();
937947
return false;
938948
}
939949

@@ -1188,7 +1198,7 @@
11881198
scroll_top = y;
11891199
scroll_bottom = y - height_menu + height_item;
11901200

1191-
if (y + height_item > height_menu - scroll) {
1201+
if (y + height_item > height_menu + scroll) {
11921202
self.$dropdown_content.stop().animate({scrollTop: scroll_bottom}, animate ? self.settings.scrollDuration : 0);
11931203
} else if (y < scroll) {
11941204
self.$dropdown_content.stop().animate({scrollTop: scroll_top}, animate ? self.settings.scrollDuration : 0);
@@ -1666,10 +1676,14 @@
16661676
var i, active, options, value_next;
16671677
value = hash_key(value);
16681678

1679+
if (self.items.indexOf(value) !== -1) {
1680+
if (inputMode === 'single') self.close();
1681+
return;
1682+
}
1683+
1684+
if (!self.options.hasOwnProperty(value)) return;
16691685
if (inputMode === 'single') self.clear();
16701686
if (inputMode === 'multi' && self.isFull()) return;
1671-
if (self.items.indexOf(value) !== -1) return;
1672-
if (!self.options.hasOwnProperty(value)) return;
16731687

16741688
$item = $(self.render('item', self.options[value]));
16751689
self.items.splice(self.caretPos, 0, value);
@@ -1818,10 +1832,10 @@
18181832
var isFull = self.isFull();
18191833
var isLocked = self.isLocked;
18201834

1821-
this.$wrapper
1835+
self.$wrapper
18221836
.toggleClass('rtl', self.rtl);
18231837

1824-
this.$control
1838+
self.$control
18251839
.toggleClass('focus', self.isFocused)
18261840
.toggleClass('disabled', self.isDisabled)
18271841
.toggleClass('required', self.isRequired)
@@ -1833,7 +1847,7 @@
18331847
.toggleClass('has-options', !$.isEmptyObject(self.options))
18341848
.toggleClass('has-items', self.items.length > 0);
18351849

1836-
this.$control_input.data('grow', !isFull && !isLocked);
1850+
self.$control_input.data('grow', !isFull && !isLocked);
18371851
},
18381852

18391853
/**
@@ -1901,7 +1915,7 @@
19011915
self.$dropdown.css({visibility: 'hidden', display: 'block'});
19021916
self.positionDropdown();
19031917
self.$dropdown.css({visibility: 'visible'});
1904-
self.trigger('dropdown_open', this.$dropdown);
1918+
self.trigger('dropdown_open', self.$dropdown);
19051919
},
19061920

19071921
/**
@@ -1911,7 +1925,7 @@
19111925
var self = this;
19121926
var trigger = self.isOpen;
19131927

1914-
if (self.settings.mode === 'single' && this.items.length) {
1928+
if (self.settings.mode === 'single' && self.items.length) {
19151929
self.hideInput();
19161930
}
19171931

@@ -2192,6 +2206,7 @@
21922206
self.$input
21932207
.html('')
21942208
.append(revertSettings.$children)
2209+
.removeAttr('tabindex')
21952210
.attr({tabindex: revertSettings.tabindex})
21962211
.show();
21972212

@@ -2241,10 +2256,10 @@
22412256
}
22422257
if (templateName === 'optgroup') {
22432258
id = data[self.settings.optgroupValueField] || '';
2244-
html = html.replace(regex_tag, '<$1 data-group="' + escape_html(id) + '"');
2259+
html = html.replace(regex_tag, '<$1 data-group="' + escape_replace(escape_html(id)) + '"');
22452260
}
22462261
if (templateName === 'option' || templateName === 'item') {
2247-
html = html.replace(regex_tag, '<$1 data-value="' + escape_html(value || '') + '"');
2262+
html = html.replace(regex_tag, '<$1 data-value="' + escape_replace(escape_html(value || '')) + '"');
22482263
}
22492264

22502265
// update cache
@@ -2257,6 +2272,7 @@
22572272

22582273
});
22592274

2275+
22602276
Selectize.count = 0;
22612277
Selectize.defaults = {
22622278
plugins: [],

dist/js/selectize.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/standalone/selectize.js

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@
583583
}));
584584

585585
/**
586-
* selectize.js (v0.8.1)
586+
* selectize.js (v0.8.2)
587587
* Copyright (c) 2013 Brian Reavis & contributors
588588
*
589589
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -741,6 +741,16 @@
741741
.replace(/"/g, '&quot;');
742742
};
743743

744+
/**
745+
* Escapes "$" characters in replacement strings.
746+
*
747+
* @param {string} str
748+
* @returns {string}
749+
*/
750+
var escape_replace = function(str) {
751+
return (str + '').replace(/\$/g, '$$$$');
752+
};
753+
744754
var hook = {};
745755

746756
/**
@@ -1042,7 +1052,7 @@
10421052
highlightedValue : null,
10431053
isOpen : false,
10441054
isDisabled : false,
1045-
isRequired : $input.is(':required'),
1055+
isRequired : $input.is('[required]'),
10461056
isInvalid : false,
10471057
isLocked : false,
10481058
isFocused : false,
@@ -1418,7 +1428,7 @@
14181428
}
14191429
break;
14201430
case KEY_ESC:
1421-
self.blur();
1431+
self.close();
14221432
return;
14231433
case KEY_DOWN:
14241434
if (!self.isOpen && self.hasOptions) {
@@ -1517,7 +1527,7 @@
15171527
self.isFocused = true;
15181528
if (self.isDisabled) {
15191529
self.blur();
1520-
e.preventDefault();
1530+
e && e.preventDefault();
15211531
return false;
15221532
}
15231533

@@ -1772,7 +1782,7 @@
17721782
scroll_top = y;
17731783
scroll_bottom = y - height_menu + height_item;
17741784

1775-
if (y + height_item > height_menu - scroll) {
1785+
if (y + height_item > height_menu + scroll) {
17761786
self.$dropdown_content.stop().animate({scrollTop: scroll_bottom}, animate ? self.settings.scrollDuration : 0);
17771787
} else if (y < scroll) {
17781788
self.$dropdown_content.stop().animate({scrollTop: scroll_top}, animate ? self.settings.scrollDuration : 0);
@@ -2250,10 +2260,14 @@
22502260
var i, active, options, value_next;
22512261
value = hash_key(value);
22522262

2263+
if (self.items.indexOf(value) !== -1) {
2264+
if (inputMode === 'single') self.close();
2265+
return;
2266+
}
2267+
2268+
if (!self.options.hasOwnProperty(value)) return;
22532269
if (inputMode === 'single') self.clear();
22542270
if (inputMode === 'multi' && self.isFull()) return;
2255-
if (self.items.indexOf(value) !== -1) return;
2256-
if (!self.options.hasOwnProperty(value)) return;
22572271

22582272
$item = $(self.render('item', self.options[value]));
22592273
self.items.splice(self.caretPos, 0, value);
@@ -2402,10 +2416,10 @@
24022416
var isFull = self.isFull();
24032417
var isLocked = self.isLocked;
24042418

2405-
this.$wrapper
2419+
self.$wrapper
24062420
.toggleClass('rtl', self.rtl);
24072421

2408-
this.$control
2422+
self.$control
24092423
.toggleClass('focus', self.isFocused)
24102424
.toggleClass('disabled', self.isDisabled)
24112425
.toggleClass('required', self.isRequired)
@@ -2417,7 +2431,7 @@
24172431
.toggleClass('has-options', !$.isEmptyObject(self.options))
24182432
.toggleClass('has-items', self.items.length > 0);
24192433

2420-
this.$control_input.data('grow', !isFull && !isLocked);
2434+
self.$control_input.data('grow', !isFull && !isLocked);
24212435
},
24222436

24232437
/**
@@ -2485,7 +2499,7 @@
24852499
self.$dropdown.css({visibility: 'hidden', display: 'block'});
24862500
self.positionDropdown();
24872501
self.$dropdown.css({visibility: 'visible'});
2488-
self.trigger('dropdown_open', this.$dropdown);
2502+
self.trigger('dropdown_open', self.$dropdown);
24892503
},
24902504

24912505
/**
@@ -2495,7 +2509,7 @@
24952509
var self = this;
24962510
var trigger = self.isOpen;
24972511

2498-
if (self.settings.mode === 'single' && this.items.length) {
2512+
if (self.settings.mode === 'single' && self.items.length) {
24992513
self.hideInput();
25002514
}
25012515

@@ -2776,6 +2790,7 @@
27762790
self.$input
27772791
.html('')
27782792
.append(revertSettings.$children)
2793+
.removeAttr('tabindex')
27792794
.attr({tabindex: revertSettings.tabindex})
27802795
.show();
27812796

@@ -2825,10 +2840,10 @@
28252840
}
28262841
if (templateName === 'optgroup') {
28272842
id = data[self.settings.optgroupValueField] || '';
2828-
html = html.replace(regex_tag, '<$1 data-group="' + escape_html(id) + '"');
2843+
html = html.replace(regex_tag, '<$1 data-group="' + escape_replace(escape_html(id)) + '"');
28292844
}
28302845
if (templateName === 'option' || templateName === 'item') {
2831-
html = html.replace(regex_tag, '<$1 data-value="' + escape_html(value || '') + '"');
2846+
html = html.replace(regex_tag, '<$1 data-value="' + escape_replace(escape_html(value || '')) + '"');
28322847
}
28332848

28342849
// update cache
@@ -2841,6 +2856,7 @@
28412856

28422857
});
28432858

2859+
28442860
Selectize.count = 0;
28452861
Selectize.defaults = {
28462862
plugins: [],

dist/js/standalone/selectize.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/less/selectize.bootstrap2.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.bootstrap2.css (v0.8.1) - Bootstrap 2 Theme
2+
* selectize.bootstrap2.css (v0.8.2) - Bootstrap 2 Theme
33
* Copyright (c) 2013 Brian Reavis & contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this

dist/less/selectize.bootstrap3.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.bootstrap3.css (v0.8.1) - Bootstrap 3 Theme
2+
* selectize.bootstrap3.css (v0.8.2) - Bootstrap 3 Theme
33
* Copyright (c) 2013 Brian Reavis & contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this

dist/less/selectize.default.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.default.css (v0.8.1) - Default Theme
2+
* selectize.default.css (v0.8.2) - Default Theme
33
* Copyright (c) 2013 Brian Reavis & contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this

dist/less/selectize.legacy.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.legacy.css (v0.8.1) - Default Theme
2+
* selectize.legacy.css (v0.8.2) - Default Theme
33
* Copyright (c) 2013 Brian Reavis & contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "selectize",
33
"keywords": ["select", "ui", "form", "input", "control", "autocomplete", "tagging", "tag"],
44
"description": "Selectize is a jQuery-based custom <select> UI control. Useful for tagging, contact lists, country selectors, etc.",
5-
"version": "0.8.1",
5+
"version": "0.8.2",
66
"author": "Brian Reavis <brian@thirdroute.com>",
77
"repository": {
88
"type": "git",

selectize.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "selectize",
3-
"version": "0.8.1",
3+
"version": "0.8.2",
44
"title": "Selectize.js",
55
"author": {
66
"name": "Brian Reavis",

0 commit comments

Comments
 (0)