1 /**
  2  * Hilo
  3  * Copyright 2015 alibaba.com
  4  * Licensed under the MIT License
  5  */
  6 
  7 var arrayProto = Array.prototype,
  8     slice = arrayProto.slice;
  9 
 10 //polyfiil for Array.prototype.indexOf
 11 if (!arrayProto.indexOf) {
 12     arrayProto.indexOf = function(elem, fromIndex){
 13         fromIndex = fromIndex || 0;
 14         var len = this.length, i;
 15         if(len == 0 || fromIndex >= len) return -1;
 16         if(fromIndex < 0) fromIndex = len + fromIndex;
 17         for(i = fromIndex; i < len; i++){
 18             if(this[i] === elem) return i;
 19         }
 20         return -1;
 21     };
 22 }
 23 
 24 var fnProto = Function.prototype;
 25 
 26 //polyfill for Function.prototype.bind
 27 if (!fnProto.bind) {
 28     fnProto.bind = function(thisArg){
 29         var target = this,
 30             boundArgs = slice.call(arguments, 1),
 31             F = function(){};
 32 
 33         function bound(){
 34             var args = boundArgs.concat(slice.call(arguments));
 35             return target.apply(this instanceof bound ? this : thisArg, args);
 36         }
 37 
 38         F.prototype = target.prototype;
 39         bound.prototype = new F();
 40 
 41         return bound;
 42     };
 43 }