JS跨浏览器的不一致/差异 [英] JS cross browser inconsistencies/differences

查看:96
本文介绍了JS跨浏览器的不一致/差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

浏览器之间存在大量DOM / CSS不一致。但浏览器之间存在多少核心JS差异?最近让我失望的是,在Firefox中,setTimeout回调函数会传递一个额外的参数(https://developer.mozilla.org/en/window.setTimeout)。

There are lots of DOM/CSS inconsistencies between browsers. But how many core JS differences are there between browsers? One that recently tripped me up is that in Firefox, setTimeout callback functions get passed an extra parameter (https://developer.mozilla.org/en/window.setTimeout).

此外,现在浏览器正在实现新的功能(例如Array.map),如果你试图知道你可以/不能使用它会让人感到困惑编写必须适用于所有浏览器的代码(甚至回到IE6)。

Also, now that browsers are implementing new functions (e.g. Array.map), it can get confusing to know what you can/can't use if you are trying to write code that must work on all browsers (even back to IE6).

是否有一个网站可以清晰地组织这些类型的差异?

Is there a website that cleanly organizes these types of differences?

推荐答案

我找到 QuirksMode WebDevout 拥有关于CSS和DOM怪癖的最佳表格。您可以使用jQuery来弥补这些不兼容性。保罗爱尔兰还有这个伟大的名单,其中包括漂亮的你可能需要的任何polyfill,包括ES5方法,如Array.map。

I find QuirksMode and WebDevout to have the best tables regarding CSS and DOM quirks. You can bridge those incompatibilities with jQuery. There is also this great list started by Paul Irish which includes pretty much any polyfill you could ever need, including ones for ES5 methods such as Array.map.

这篇关于JS跨浏览器的不一致/差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆