Explorar o código

Merge pull request #71 from niquola/master

fix indexOf with undefined
Igor Vaynberg %!s(int64=13) %!d(string=hai) anos
pai
achega
26da9f0b2e
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      select2.js

+ 4 - 0
select2.js

@@ -70,6 +70,10 @@
     function indexOf(value, array) {
         var i = 0, l = array.length, v;
 
+        if (typeof value == 'undefined') {
+          return -1;
+        }
+
         if (value.constructor === String) {
             for (; i < l; i = i + 1) if (value.localeCompare(array[i]) === 0) return i;
         } else {