浏览代码

Fix up arrow error when there is no options

rodrigo.perez 7 年之前
父节点
当前提交
34e8b695f0
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/js/select2/results.js

+ 2 - 1
src/js/select2/results.js

@@ -340,7 +340,8 @@ define([
       var currentIndex = $options.index($highlighted);
       var currentIndex = $options.index($highlighted);
 
 
       // If we are already at te top, don't move further
       // If we are already at te top, don't move further
-      if (currentIndex === 0) {
+      // If no options, currentIndex will be -1
+      if (currentIndex <= 0) {
         return;
         return;
       }
       }