Bug Tracker

Ticket #1368: iutil.js.fix.txt

File iutil.js.fix.txt, 558 bytes (added by jbwyme, 15 years ago)

code

Line 
1// Helper function to support older browsers!
2[].indexOf || (Array.prototype.indexOf = function(v, n){
3        n = (n == null) ? 0 : n;
4        var m = this.length;
5        for (var i=n; i<m; i++)
6                if (this[i] == v)
7                        return i;
8        return -1;
9});
10
11
12
13change to this:
14
15
16
17// Helper function to support older browsers! if (![].indexOf) {
18
19    Array.prototype.indexOf = function(v, n){
20
21        n = (n == null) ? 0 : n; var m = this.length; for (var i=n; i<m; i++)
22
23            if (this[i] == v)
24
25                return i;
26
27        return -1;
28
29    });
30
31}