Skip to content

Commit

Permalink
Array.indexOf is not cross browser
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanboniface committed Jul 9, 2015
1 parent a034bdc commit c173edb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ L.Util = {
return (Object.prototype.toString.call(obj) === '[object Array]');
},

indexOf: Array.indexOf || function (array, el) {
indexOf: function (array, el) {
if (array.indexOf) {
return array.indexOf(el);
}
for (var i = 0; i < array.length; i++) {
if (array[i] === el) { return i; }
}
Expand Down

0 comments on commit c173edb

Please sign in to comment.