Skip to content

Commit 46d0b35

Browse files
committed
Released 0.7.7.
1 parent 586ea16 commit 46d0b35

16 files changed

+69
-49
lines changed

bower.json

+1-1
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.7.6",
5+
"version": "0.7.7",
66
"license": "Apache License, Version 2.0",
77
"readmeFilename": "README.md",
88
"repository": {

dist/css/selectize.bootstrap2.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.bootstrap2.css (v0.7.6) - Bootstrap 2 Theme
2+
* selectize.bootstrap2.css (v0.7.7) - 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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.bootstrap3.css (v0.7.6) - Bootstrap 3 Theme
2+
* selectize.bootstrap3.css (v0.7.7) - 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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.css (v0.7.6)
2+
* selectize.css (v0.7.7)
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.default.css (v0.7.6) - Default Theme
2+
* selectize.default.css (v0.7.7) - 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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.legacy.css (v0.7.6) - Default Theme
2+
* selectize.legacy.css (v0.7.7) - 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

+26-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.js (v0.7.6)
2+
* selectize.js (v0.7.7)
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,17 +157,6 @@
157157
.replace(/"/g, '&quot;');
158158
};
159159

160-
/**
161-
* Escapes quotation marks with backslashes. Useful
162-
* for escaping values for use in CSS attribute selectors.
163-
*
164-
* @param {string} str
165-
* @return {string}
166-
*/
167-
var escape_quotes = function(str) {
168-
return str.replace(/(['"])/g, '\\$1');
169-
};
170-
171160
var hook = {};
172161

173162
/**
@@ -1429,7 +1418,7 @@
14291418
*/
14301419
addOptionGroup: function(id, data) {
14311420
this.optgroups[id] = data;
1432-
this.trigger('optgroup_add', value, data);
1421+
this.trigger('optgroup_add', id, data);
14331422
},
14341423

14351424
/**
@@ -1527,8 +1516,7 @@
15271516
* @returns {object}
15281517
*/
15291518
getOption: function(value) {
1530-
value = hash_key(value);
1531-
return value ? this.$dropdown_content.find('[data-selectable]').filter('[data-value="' + escape_quotes(value) + '"]:first') : $();
1519+
return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
15321520
},
15331521

15341522
/**
@@ -1546,6 +1534,28 @@
15461534
return index >= 0 && index < $options.length ? $options.eq(index) : $();
15471535
},
15481536

1537+
/**
1538+
* Finds the first element with a "data-value" attribute
1539+
* that matches the given value.
1540+
*
1541+
* @param {mixed} value
1542+
* @param {object} $els
1543+
* @return {object}
1544+
*/
1545+
getElementWithValue: function(value, $els) {
1546+
value = hash_key(value);
1547+
1548+
if (value) {
1549+
for (var i = 0, n = $els.length; i < n; i++) {
1550+
if ($els[i].getAttribute('data-value') === value) {
1551+
return $($els[i]);
1552+
}
1553+
}
1554+
}
1555+
1556+
return $();
1557+
},
1558+
15491559
/**
15501560
* Returns the jQuery element of the item
15511561
* matching the given value.
@@ -1554,7 +1564,7 @@
15541564
* @returns {object}
15551565
*/
15561566
getItem: function(value) {
1557-
return this.$control.children('[data-value="' + escape_quotes(hash_key(value)) + '"]');
1567+
return this.getElementWithValue(value, this.$control.children());
15581568
},
15591569

15601570
/**

dist/js/selectize.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/standalone/selectize.js

+26-16
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@
470470
}));
471471

472472
/**
473-
* selectize.js (v0.7.6)
473+
* selectize.js (v0.7.7)
474474
* Copyright (c) 2013 Brian Reavis & contributors
475475
*
476476
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -628,17 +628,6 @@
628628
.replace(/"/g, '&quot;');
629629
};
630630

631-
/**
632-
* Escapes quotation marks with backslashes. Useful
633-
* for escaping values for use in CSS attribute selectors.
634-
*
635-
* @param {string} str
636-
* @return {string}
637-
*/
638-
var escape_quotes = function(str) {
639-
return str.replace(/(['"])/g, '\\$1');
640-
};
641-
642631
var hook = {};
643632

644633
/**
@@ -1900,7 +1889,7 @@
19001889
*/
19011890
addOptionGroup: function(id, data) {
19021891
this.optgroups[id] = data;
1903-
this.trigger('optgroup_add', value, data);
1892+
this.trigger('optgroup_add', id, data);
19041893
},
19051894

19061895
/**
@@ -1998,8 +1987,7 @@
19981987
* @returns {object}
19991988
*/
20001989
getOption: function(value) {
2001-
value = hash_key(value);
2002-
return value ? this.$dropdown_content.find('[data-selectable]').filter('[data-value="' + escape_quotes(value) + '"]:first') : $();
1990+
return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
20031991
},
20041992

20051993
/**
@@ -2017,6 +2005,28 @@
20172005
return index >= 0 && index < $options.length ? $options.eq(index) : $();
20182006
},
20192007

2008+
/**
2009+
* Finds the first element with a "data-value" attribute
2010+
* that matches the given value.
2011+
*
2012+
* @param {mixed} value
2013+
* @param {object} $els
2014+
* @return {object}
2015+
*/
2016+
getElementWithValue: function(value, $els) {
2017+
value = hash_key(value);
2018+
2019+
if (value) {
2020+
for (var i = 0, n = $els.length; i < n; i++) {
2021+
if ($els[i].getAttribute('data-value') === value) {
2022+
return $($els[i]);
2023+
}
2024+
}
2025+
}
2026+
2027+
return $();
2028+
},
2029+
20202030
/**
20212031
* Returns the jQuery element of the item
20222032
* matching the given value.
@@ -2025,7 +2035,7 @@
20252035
* @returns {object}
20262036
*/
20272037
getItem: function(value) {
2028-
return this.$control.children('[data-value="' + escape_quotes(hash_key(value)) + '"]');
2038+
return this.getElementWithValue(value, this.$control.children());
20292039
},
20302040

20312041
/**

dist/js/standalone/selectize.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/less/selectize.bootstrap2.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.bootstrap2.css (v0.7.6) - Bootstrap 2 Theme
2+
* selectize.bootstrap2.css (v0.7.7) - 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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.bootstrap3.css (v0.7.6) - Bootstrap 3 Theme
2+
* selectize.bootstrap3.css (v0.7.7) - 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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.default.css (v0.7.6) - Default Theme
2+
* selectize.default.css (v0.7.7) - 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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* selectize.legacy.css (v0.7.6) - Default Theme
2+
* selectize.legacy.css (v0.7.7) - 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

+1-1
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.7.6",
5+
"version": "0.7.7",
66
"author": "Brian Reavis <[email protected]>",
77
"repository": {
88
"type": "git",

selectize.jquery.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "selectize",
3-
"version": "0.7.6",
3+
"version": "0.7.7",
44
"title": "Selectize.js",
55
"author": {
66
"name": "Brian Reavis",

0 commit comments

Comments
 (0)