Authored by xuqi

indexof polyfill

/**
* Array indexof polyfill
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2016/8/8
* @source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
*/
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(searchElement, fromIndex) { // eslint-disable-line
var k;
var o;
var len;
var n;
if (this == null) { // eslint-disable-line
throw new TypeError('"this" is null or not defined');
}
o = Object(this);
len = o.length >>> 0;
if (len === 0) {
return -1;
}
n = +fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
if (n >= len) {
return -1;
}
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
while (k < len) {
if (k in o && o[k] === searchElement) {
return k;
}
k++;
}
return -1;
};
}
... ...
... ... @@ -25,6 +25,7 @@ var editTpl = require('../../../tpl/shopping/edit-color-size.hbs');
var Cart;
require('yoho-jquery-dotdotdot');
require('../../common/indexof-polyfill'); // array indexof polyfill
function dotName() {
... ...