a8m / a8m/angular-filter

bug with String.contains polyfill

未关闭
#260 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
2.9k
派生
319
PR 合并指标
30 天内没有已合并 PR

描述

Using and loving this library. Found a bug with the String.contains polyfill. Another library was calling a for in loop on a string and the contains function was showing as a property. That library was then calling the function anonymously which led to an exception being thrown. We included a fix in our code before importing your library and I'm sharing it with you if you are interested in applying it to this library:
if(!String.prototype.contains){
Object.defineProperty(String.prototype, 'contains', {
enumerable: false,
value: function() {
return String.prototype.indexOf.apply(this, arguments) !== -1;
}
});
}

You can test out the fix by running the following code before and after this fix:
for(var i in ''){ console.log(i);var fn = ''[i]; fn();}

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。