1
0
mirror of synced 2024-11-23 05:26:10 +03:00

Fix issue introduced by 20950e0f0c.

Selected items and other invisible items were not ignored by highlightUnderEvent when calculating index.
This caused highlighting of incorrect items when the list contained hidden items.
This commit is contained in:
Barry Coughlan 2013-01-29 18:45:33 +00:00
parent 1aa4db12d7
commit 89d583736a

View File

@ -1126,7 +1126,7 @@ the specific language governing permissions and limitations under the Apache Lic
highlightUnderEvent: function (event) { highlightUnderEvent: function (event) {
var el = $(event.target).closest(".select2-result-selectable"); var el = $(event.target).closest(".select2-result-selectable");
if (el.length > 0 && !el.is(".select2-highlighted")) { if (el.length > 0 && !el.is(".select2-highlighted")) {
var choices = this.results.find('.select2-result'); var choices = this.results.find('.select2-result:visible');
this.highlight(choices.index(el)); this.highlight(choices.index(el));
} else if (el.length == 0) { } else if (el.length == 0) {
// if we are over an unselectable item remove al highlights // if we are over an unselectable item remove al highlights