Skip to content

Commit

Permalink
fix: v0.3.7 does not work in ie8 fix #105
Browse files Browse the repository at this point in the history
  • Loading branch information
maksimr committed Feb 23, 2016
1 parent 631f42d commit d44b489
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,37 @@ function createStartFn(karma, jasmineEnv) {
jasmineEnv.execute();
};
}


// Polyfills for correct work adapter in IE8
if (!('indexOf' in Array.prototype)) {
Array.prototype.indexOf = function(find, i /*opt*/) {
if (i === undefined) {i = 0;}
if (i < 0) {i += this.length;}
if (i < 0) {i = 0;}
for (var n = this.length; i < n; i++){
if (i in this && this[i] === find){
return i;}}
return -1;
};
}

if (!('map' in Array.prototype)) {
Array.prototype.map = function(mapper, that /*opt*/) {
var other = new Array(this.length);
for (var i = 0, n = this.length; i < n; i++){
if (i in this){
other[i] = mapper.call(that, this[i], i, this);}}
return other;
};
}

if (!('filter' in Array.prototype)) {
Array.prototype.filter = function(filter, that /*opt*/) {
var other = [], v;
for (var i = 0, n = this.length; i < n; i++){
if (i in this && filter.call(that, v = this[i], i, this)){
other.push(v);}}
return other;
};
}

0 comments on commit d44b489

Please sign in to comment.