compat.js 480 B

12345678910111213141516171819202122
  1. /* IE<9 does not have Array.indexOf , needed for amber */
  2. if (!Array.prototype.indexOf) {
  3. Array.prototype.indexOf = function(elt /*, from*/)
  4. {
  5. var len = this.length >>> 0;
  6. var from = Number(arguments[1]) || 0;
  7. from = (from < 0)
  8. ? Math.ceil(from)
  9. : Math.floor(from);
  10. if (from < 0)
  11. from += len;
  12. for (; from < len; from++)
  13. {
  14. if (from in this &&
  15. this[from] === elt)
  16. return from;
  17. }
  18. return -1;
  19. };
  20. }