ie8及以下浏览器兼容catch方法

这本不算一个bug,非Edge内核的IE都不支持Promise。
一些按照Promise/A+标准实现的库语法和旧版IE冲突。

This is because IE8 implements ECMAScript 3 that does not allow bare keywords in dot notation. Modern browsers implement ECMAScript 5 that allows it.

A lot of libraries alias .catch with another keyword. However, the way Angular promises are built it is not simple to extend $q promises. So ["catch"] would have to do. Note this is also true for finally.

es6Promise

Usage in IE<9
catch is a reserved word in IE<9, meaning promise.catch(func) throws a syntax error. To work around this, you can use a string to access the property as shown in the following example.

However, please remember that such technique is already provided by most common minifiers, making the resulting code safe for old browsers and production:

参考


siwuxie
528 声望67 粉丝

404


« 上一篇
吐槽专用
下一篇 »
项目bug整理

引用和评论

0 条评论