Updating to latest version of chosen.js

This commit is contained in:
Patrick Filler 2011-07-15 18:05:22 -04:00
parent 68722b9070
commit 3884c55c8b

View file

@ -211,7 +211,7 @@
data = _ref[_i]; data = _ref[_i];
if (data.group) { if (data.group) {
content += this.result_add_group(data); content += this.result_add_group(data);
} else { } else if (!data.empty) {
content += this.result_add_option(data); content += this.result_add_option(data);
if (data.selected && this.is_multiple) { if (data.selected && this.is_multiple) {
this.choice_build(data); this.choice_build(data);
@ -447,7 +447,7 @@
_ref = this.results_data; _ref = this.results_data;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
option = _ref[_i]; option = _ref[_i];
if (!option.disabled) { if (!option.disabled && !option.empty) {
if (option.group) { if (option.group) {
$(option.dom_id).hide(); $(option.dom_id).hide();
} else if (!(this.is_multiple && option.selected)) { } else if (!(this.is_multiple && option.selected)) {
@ -715,7 +715,8 @@
}; };
OptionsParser.prototype.add_option = function(option, group_id, group_disabled) { OptionsParser.prototype.add_option = function(option, group_id, group_disabled) {
var _ref; var _ref;
if (option.nodeName === "OPTION" && (this.sel_index > 0 || option.text !== "")) { if (option.nodeName === "OPTION") {
if (option.text !== "") {
if (group_id || group_id === 0) { if (group_id || group_id === 0) {
this.parsed[group_id].children += 1; this.parsed[group_id].children += 1;
} }
@ -730,6 +731,11 @@
}, },
group_id: group_id group_id: group_id
}); });
} else {
this.parsed.push({
empty: true
});
}
return this.sel_index += 1; return this.sel_index += 1;
} }
}; };