Skip to content

Commit b308921

Browse files
committed
fix tracking of results under mouse. fixes select2#258
1 parent e620b54 commit b308921

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

select2.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,20 +1891,29 @@
18911891
postprocessResults: function () {
18921892
var val = this.getVal(),
18931893
choices = this.results.find(".select2-result-selectable"),
1894+
compound = this.results.find(".select2-result-with-children"),
18941895
self = this;
18951896

18961897
choices.each2(function (i, choice) {
18971898
var id = self.id(choice.data("select2-data"));
18981899
if (indexOf(id, val) >= 0) {
1899-
choice.addClass("select2-disabled");
1900+
choice.addClass("select2-disabled").removeClass("select2-result-selectable");
19001901
} else {
1901-
choice.removeClass("select2-disabled");
1902+
choice.removeClass("select2-disabled").addClass("select2-result-selectable");
1903+
}
1904+
});
1905+
1906+
compound.each2(function(i, e) {
1907+
if (e.find(".select2-result-selectable").length==0) {
1908+
e.addClass("select2-disabled");
1909+
} else {
1910+
e.removeClass("select2-disabled");
19021911
}
19031912
});
19041913

19051914
choices.each2(function (i, choice) {
1906-
if (!choice.hasClass("select2-disabled")) {
1907-
self.highlight(i);
1915+
if (!choice.hasClass("select2-disabled") && choice.hasClass("select2-result-selectable")) {
1916+
self.highlight(0);
19081917
return false;
19091918
}
19101919
});

0 commit comments

Comments
 (0)