IE不兼容解决办法:写个共用方法:
Array.prototype.myfilter = function (fun /*, thisp*/) {
var len = this.length;
if (typeof fun != "function") {
throw new TypeError();
}
var res = new Array();
var thisp = arguments[1];
for (var i = 0; i < len; i++) {
if (i in this) {
var val = this[i]; // in case fun mutates this
if (fun.call(thisp, val, i, this)) {
res.push(val);
}
}
}
return res;
};
// 页面引用之后调用
//var childUserNodes = childNodes.filter(item => item.indexOf('u') > 0)
var childUserNodes = childNodes.myfilter(function (item, inde, array) {
return item.indexOf('u') > 0; //过滤条件,根据自己需求修改
})