Skip to main content

Bug Tracker

Side navigation

Ticket #1368: iutil.js.fix.txt


File iutil.js.fix.txt, 0.5 KB (added by jbwyme, July 07, 2007 12:46AM UTC)

code

// Helper function to support older browsers!
[].indexOf || (Array.prototype.indexOf = function(v, n){
	n = (n == null) ? 0 : n;
	var m = this.length;
	for (var i=n; i<m; i++)
		if (this[i] == v)
			return i;
	return -1;
});



change to this:



// Helper function to support older browsers! if (![].indexOf) {

    Array.prototype.indexOf = function(v, n){

        n = (n == null) ? 0 : n; var m = this.length; for (var i=n; i<m; i++)

            if (this[i] == v)

                return i;

        return -1;

    });

}

Download in other formats:

Original Format