Skip to content

Commit f293d8b

Browse files
committed
Released 0.11.0.
1 parent c8f2944 commit f293d8b

16 files changed

+60
-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.10.1",
5+
"version": "0.11.0",
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.10.1) - Bootstrap 2 Theme
2+
* selectize.bootstrap2.css (v0.11.0) - 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.bootstrap3.css (v0.10.1) - Bootstrap 3 Theme
2+
* selectize.bootstrap3.css (v0.11.0) - 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
@@ -257,7 +257,7 @@
257257
border-top: 0 none;
258258
}
259259
.selectize-dropdown .optgroup-header {
260-
color: #999999;
260+
color: #777777;
261261
background: #ffffff;
262262
cursor: default;
263263
}

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.10.1)
2+
* selectize.css (v0.11.0)
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.10.1) - Default Theme
2+
* selectize.default.css (v0.11.0) - 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.10.1) - Default Theme
2+
* selectize.legacy.css (v0.11.0) - 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: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.js (v0.10.1)
2+
* selectize.js (v0.11.0)
33
* Copyright (c) 2013 Brian Reavis & contributors
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -140,10 +140,10 @@
140140
* 1 -> '1'
141141
*
142142
* @param {string} value
143-
* @returns {string}
143+
* @returns {string|null}
144144
*/
145145
var hash_key = function(value) {
146-
if (typeof value === 'undefined' || value === null) return '';
146+
if (typeof value === 'undefined' || value === null) return null;
147147
if (typeof value === 'boolean') return value ? '1' : '0';
148148
return value + '';
149149
};
@@ -1082,7 +1082,7 @@
10821082
self.createItem();
10831083
} else {
10841084
value = $target.attr('data-value');
1085-
if (value) {
1085+
if (typeof value !== 'undefined') {
10861086
self.lastQuery = null;
10871087
self.setTextboxValue('');
10881088
self.addItem(value);
@@ -1573,7 +1573,7 @@
15731573
}
15741574

15751575
value = hash_key(data[self.settings.valueField]);
1576-
if (!value || self.options.hasOwnProperty(value)) return;
1576+
if (typeof value !== 'string' || self.options.hasOwnProperty(value)) return;
15771577

15781578
self.userOptions[value] = true;
15791579
self.options[value] = data;
@@ -1610,8 +1610,9 @@
16101610
value_new = hash_key(data[self.settings.valueField]);
16111611

16121612
// sanity checks
1613+
if (value === null) return;
16131614
if (!self.options.hasOwnProperty(value)) return;
1614-
if (!value_new) throw new Error('Value must be set in option data');
1615+
if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
16151616

16161617
// update references
16171618
if (value_new !== value) {
@@ -1723,7 +1724,7 @@
17231724
getElementWithValue: function(value, $els) {
17241725
value = hash_key(value);
17251726

1726-
if (value) {
1727+
if (typeof value !== 'undefined' && value !== null) {
17271728
for (var i = 0, n = $els.length; i < n; i++) {
17281729
if ($els[i].getAttribute('data-value') === value) {
17291730
return $($els[i]);
@@ -1889,7 +1890,7 @@
18891890

18901891
if (!data || typeof data !== 'object') return;
18911892
var value = hash_key(data[self.settings.valueField]);
1892-
if (!value) return;
1893+
if (typeof value !== 'string') return;
18931894

18941895
self.setTextboxValue('');
18951896
self.addOption(data);
@@ -2428,6 +2429,7 @@
24282429
addPrecedence: false,
24292430
selectOnTab: false,
24302431
preload: false,
2432+
allowEmptyOption: false,
24312433

24322434
scrollDuration: 60,
24332435
loadThrottle: 300,
@@ -2498,7 +2500,7 @@
24982500
*/
24992501
var init_textbox = function($input, settings_element) {
25002502
var i, n, values, option, value = $.trim($input.val() || '');
2501-
if (!value.length) return;
2503+
if (!settings.allowEmptyOption && !value.length) return;
25022504

25032505
values = value.split(settings.delimiter);
25042506
for (i = 0, n = values.length; i < n; i++) {
@@ -2536,7 +2538,7 @@
25362538
$option = $($option);
25372539

25382540
value = $option.attr('value') || '';
2539-
if (!value.length) return;
2541+
if (!value.length && !settings.allowEmptyOption) return;
25402542

25412543
// if the option already exists, it's probably been
25422544
// duplicated in another optgroup. in this case, push
@@ -2606,8 +2608,13 @@
26062608
var instance;
26072609
var $input = $(this);
26082610
var tag_name = this.tagName.toLowerCase();
2611+
var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');
2612+
if (!placeholder && !settings.allowEmptyOption) {
2613+
placeholder = $input.children('option[value=""]').text();
2614+
}
2615+
26092616
var settings_element = {
2610-
'placeholder' : $input.children('option[value=""]').text() || $input.attr('placeholder'),
2617+
'placeholder' : placeholder,
26112618
'options' : {},
26122619
'optgroups' : {},
26132620
'items' : []

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: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -425,17 +425,17 @@
425425
};
426426

427427
var DIACRITICS = {
428-
'a': '[aÀÁÂÃÄÅàáâãäå]',
428+
'a': '[aÀÁÂÃÄÅàáâãäåĀā]',
429429
'c': '[cÇçćĆčČ]',
430430
'd': '[dđĐďĎ]',
431-
'e': '[eÈÉÊËèéêëěĚ]',
432-
'i': '[iÌÍÎÏìíîï]',
431+
'e': '[eÈÉÊËèéêëěĚĒē]',
432+
'i': '[iÌÍÎÏìíîïĪī]',
433433
'n': '[nÑñňŇ]',
434-
'o': '[oÒÓÔÕÕÖØòóôõöø]',
434+
'o': '[oÒÓÔÕÕÖØòóôõöøŌō]',
435435
'r': '[rřŘ]',
436436
's': '[sŠš]',
437437
't': '[tťŤ]',
438-
'u': '[uÙÚÛÜùúûüůŮ]',
438+
'u': '[uÙÚÛÜùúûüůŮŪū]',
439439
'y': '[yŸÿýÝ]',
440440
'z': '[zŽž]'
441441
};
@@ -585,7 +585,7 @@
585585
}));
586586

587587
/**
588-
* selectize.js (v0.10.1)
588+
* selectize.js (v0.11.0)
589589
* Copyright (c) 2013 Brian Reavis & contributors
590590
*
591591
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -726,10 +726,10 @@
726726
* 1 -> '1'
727727
*
728728
* @param {string} value
729-
* @returns {string}
729+
* @returns {string|null}
730730
*/
731731
var hash_key = function(value) {
732-
if (typeof value === 'undefined' || value === null) return '';
732+
if (typeof value === 'undefined' || value === null) return null;
733733
if (typeof value === 'boolean') return value ? '1' : '0';
734734
return value + '';
735735
};
@@ -1668,7 +1668,7 @@
16681668
self.createItem();
16691669
} else {
16701670
value = $target.attr('data-value');
1671-
if (value) {
1671+
if (typeof value !== 'undefined') {
16721672
self.lastQuery = null;
16731673
self.setTextboxValue('');
16741674
self.addItem(value);
@@ -2159,7 +2159,7 @@
21592159
}
21602160

21612161
value = hash_key(data[self.settings.valueField]);
2162-
if (!value || self.options.hasOwnProperty(value)) return;
2162+
if (typeof value !== 'string' || self.options.hasOwnProperty(value)) return;
21632163

21642164
self.userOptions[value] = true;
21652165
self.options[value] = data;
@@ -2196,8 +2196,9 @@
21962196
value_new = hash_key(data[self.settings.valueField]);
21972197

21982198
// sanity checks
2199+
if (value === null) return;
21992200
if (!self.options.hasOwnProperty(value)) return;
2200-
if (!value_new) throw new Error('Value must be set in option data');
2201+
if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
22012202

22022203
// update references
22032204
if (value_new !== value) {
@@ -2309,7 +2310,7 @@
23092310
getElementWithValue: function(value, $els) {
23102311
value = hash_key(value);
23112312

2312-
if (value) {
2313+
if (typeof value !== 'undefined' && value !== null) {
23132314
for (var i = 0, n = $els.length; i < n; i++) {
23142315
if ($els[i].getAttribute('data-value') === value) {
23152316
return $($els[i]);
@@ -2475,7 +2476,7 @@
24752476

24762477
if (!data || typeof data !== 'object') return;
24772478
var value = hash_key(data[self.settings.valueField]);
2478-
if (!value) return;
2479+
if (typeof value !== 'string') return;
24792480

24802481
self.setTextboxValue('');
24812482
self.addOption(data);
@@ -3014,6 +3015,7 @@
30143015
addPrecedence: false,
30153016
selectOnTab: false,
30163017
preload: false,
3018+
allowEmptyOption: false,
30173019

30183020
scrollDuration: 60,
30193021
loadThrottle: 300,
@@ -3084,7 +3086,7 @@
30843086
*/
30853087
var init_textbox = function($input, settings_element) {
30863088
var i, n, values, option, value = $.trim($input.val() || '');
3087-
if (!value.length) return;
3089+
if (!settings.allowEmptyOption && !value.length) return;
30883090

30893091
values = value.split(settings.delimiter);
30903092
for (i = 0, n = values.length; i < n; i++) {
@@ -3122,7 +3124,7 @@
31223124
$option = $($option);
31233125

31243126
value = $option.attr('value') || '';
3125-
if (!value.length) return;
3127+
if (!value.length && !settings.allowEmptyOption) return;
31263128

31273129
// if the option already exists, it's probably been
31283130
// duplicated in another optgroup. in this case, push
@@ -3192,8 +3194,13 @@
31923194
var instance;
31933195
var $input = $(this);
31943196
var tag_name = this.tagName.toLowerCase();
3197+
var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');
3198+
if (!placeholder && !settings.allowEmptyOption) {
3199+
placeholder = $input.children('option[value=""]').text();
3200+
}
3201+
31953202
var settings_element = {
3196-
'placeholder' : $input.children('option[value=""]').text() || $input.attr('placeholder'),
3203+
'placeholder' : placeholder,
31973204
'options' : {},
31983205
'optgroups' : {},
31993206
'items' : []

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.10.1) - Bootstrap 2 Theme
2+
* selectize.bootstrap2.css (v0.11.0) - 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.10.1) - Bootstrap 3 Theme
2+
* selectize.bootstrap3.css (v0.11.0) - 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.10.1) - Default Theme
2+
* selectize.default.css (v0.11.0) - 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.10.1) - Default Theme
2+
* selectize.legacy.css (v0.11.0) - 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
@@ -11,7 +11,7 @@
1111
"tag"
1212
],
1313
"description": "Selectize is a jQuery-based custom <select> UI control. Useful for tagging, contact lists, country selectors, etc.",
14-
"version": "0.10.1",
14+
"version": "0.11.0",
1515
"author": "Brian Reavis <brian@thirdroute.com>",
1616
"repository": {
1717
"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.10.1",
3+
"version": "0.11.0",
44
"title": "Selectize.js",
55
"author": {
66
"name": "Brian Reavis",

0 commit comments

Comments
 (0)