Skip to content

Commit d805054

Browse files
committed
Merged selectize#69 + added tests for selectize#70.
2 parents d3836f1 + 8116ce9 commit d805054

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

.gitignore

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.DS_Store
2-
*.log
3-
4-
# WebDAV file system cache
5-
.DAV/
2+
.DAV
3+
node_modules
4+
bower_components
5+
*.log

selectize.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2534,7 +2534,7 @@
25342534
if (!value.length) return;
25352535

25362536
settings_element.options[value] = readData($option) || {
2537-
'text' : $option.text(), //don't use .html() as it escapes - we leave that to the render
2537+
'text' : $option.text(),
25382538
'value' : value,
25392539
'optgroup' : group
25402540
};
@@ -2575,7 +2575,7 @@
25752575
var $input = $(this);
25762576
var tag_name = $input[0].tagName.toLowerCase();
25772577
var settings_element = {
2578-
'placeholder' : $input.attr('placeholder'),
2578+
'placeholder' : $input.children('option[value=""]').text() || $input.attr('placeholder'),
25792579
'options' : {},
25802580
'optgroups' : {},
25812581
'items' : []

selectize.min.js

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

src/selectize.jquery.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ $.fn.selectize = function(settings) {
5151
if (!value.length) return;
5252

5353
settings_element.options[value] = readData($option) || {
54-
'text' : $option.text(), //don't use .html() as it escapes - we leave that to the render
54+
'text' : $option.text(),
5555
'value' : value,
5656
'optgroup' : group
5757
};
@@ -92,7 +92,7 @@ $.fn.selectize = function(settings) {
9292
var $input = $(this);
9393
var tag_name = $input[0].tagName.toLowerCase();
9494
var settings_element = {
95-
'placeholder' : $input.attr('placeholder'),
95+
'placeholder' : $input.children('option[value=""]').text() || $input.attr('placeholder'),
9696
'options' : {},
9797
'optgroups' : {},
9898
'items' : []

tests/setup.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@
2727
});
2828

2929
describe('<select>', function() {
30-
it('complete without exceptions', function() {
30+
it('should complete without exceptions', function() {
3131
test = setup_test('<select>', {});
3232
test.teardown();
3333
});
34+
it('should add options in text form (no html entities)', function() {
35+
test = setup_test('<select><option selected value="a">&lt;hi&gt;</option></select>', {});
36+
expect(test.selectize.options['a'].text).to.be.equal('<hi>');
37+
test.teardown();
38+
});
3439
describe('getValue()', function() {
3540
it('should return "" when empty', function() {
3641
test = setup_test('<select>', {});
@@ -46,7 +51,7 @@
4651
});
4752

4853
describe('<select multiple>', function() {
49-
it('complete without exceptions', function() {
54+
it('should complete without exceptions', function() {
5055
test = setup_test('<select>', {});
5156
test.teardown();
5257
});

0 commit comments

Comments
 (0)