| | 1 | // This adds support for indexOF to browsers that are missing this functionality (IE) |
| | 2 | // https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference:Objects:Array:indexOf#Compatibility |
| | 3 | if (!Array.prototype.indexOf) |
| | 4 | { |
| | 5 | Array.prototype.indexOf = function(elt /*, from*/) |
| | 6 | { |
| | 7 | var len = this.length >>> 0; |
| | 8 | |
| | 9 | var from = Number(arguments[1]) || 0; |
| | 10 | from = (from < 0) |
| | 11 | ? Math.ceil(from) |
| | 12 | : Math.floor(from); |
| | 13 | if (from < 0) |
| | 14 | from += len; |
| | 15 | |
| | 16 | for (; from < len; from++) |
| | 17 | { |
| | 18 | if (from in this && |
| | 19 | this[from] === elt) |
| | 20 | return from; |
| | 21 | } |
| | 22 | return -1; |
| | 23 | }; |
| | 24 | } |
| | 25 | |