forked from awmorp/turing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolyfills.js
31 lines (27 loc) · 826 Bytes
/
polyfills.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Polyfills to make up for missing functionality in Internet Explorer */
if( !Array.prototype.filter ) {
/* console.log( "Installing Array.filter polyfill" ); */
Array.prototype.filter = function( fn, context ) {
var i, l = this.length, result = [];
for( i = 0; i < l; i++ ) {
if( this.hasOwnProperty(i) ) {
if( fn.call( context, this[i], i, this ) ) {
result.push( this[i] );
}
}
}
return( result );
};
}
if( !Array.prototype.indexOf ) {
/* console.log( "Installing Array.indexOf polyfill" ); */
Array.prototype.indexOf = function( obj, start ) {
for( var i = (start ? start : 0), j = this.length; i < j; i += 1 ) {
if( this[i] === obj ) {
return( i );
}
}
return( -1 );
}
}
var isOldIE = true;