Skip to content

Commit

Permalink
Merge pull request #25 from anselmbradford/master
Browse files Browse the repository at this point in the history
Adds Array.prototype.indexOf polyfill
  • Loading branch information
remy committed Oct 2, 2013
2 parents ef7929a + b8de590 commit 78d9e38
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions classList.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

if (typeof window.Element === "undefined" || "classList" in document.documentElement) return;

// adds indexOf to Array prototype for IE support
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) { return i; }
}
return -1;
}
}

var prototype = Array.prototype,
indexOf = prototype.indexOf,
slice = prototype.slice,
Expand Down

0 comments on commit 78d9e38

Please sign in to comment.