Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: v0.3.7 does not work in ie8 fix #105 #106

Merged
merged 1 commit into from
Mar 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
};
}