js兼容性

来源:互联网 发布:淘宝怎么投诉卖家版权 编辑:程序博客网 时间:2024/04/25 23:43
var mousewheelevt = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel"
FF:event.detail   向下:-120  向上:120
其他:event.wheelDelta   向下:3  向上:-3


在 IE8- 下,Element 对象被 removeChild 方法移除时,该Element的parentNode 仍然指向原来的父 Element 对象,与 W3C 标准兼容的属性应该是 parentElement。


ie6-? // 在怪异模式下,IE 将 body 的边框也算在了偏移值中,需要先纠正  
IE7- getBoundingClientRect返回left\right\top\bottom\width\height的对象  在IE7-下left\top是从2开始计算的 与offsetTop和obj.currentStyle.top不同,后两者没有把2加进去
IE8- borderTopWidth等   IE8-  当值为0时,值为medium


IE8- // IE下双击事件不依次产生 mousedown 与 mouseup 事件,需要模拟  dblclick 在 ie 下的事件触发顺序是 mousedown/mouseup/click/mouseup/dblclick
currEnv.mousedown(event);
currEnv.mouseup(event);


ie8- 无法访问document.head但可以访问document.body
ie7-  display:inline;zoom:1;  相当于display:inline-block;
ie8-  opacity:n  n为0-1    为  filter:alpha(opacity=n*10)


ie8- js中css  float  为styleFloat   其他则为cssFloat;


当加载script时,加载成功
IE10- // IE10-和opera支持onreadystatechange   最新的opera不支持onreadystatechange  IE10-会执行两次事件处理函数(不管加载成功与否)
// safari、chrome、opera支持onload 
还要在该函数内设置flag 避免opera,IE10-下的多次调用
                    if (scriptLoaded) {
                        return;
                    }


ie盒模型的 content 部分包含了 border 和 padding。


在 IE 下,Element 对象的属性可以通过名称直接访问,效率是 getAttribute 方式的两倍。


IE ajax当请求成功时,IE有时status会为1223


safari // safari里面,如果遍历到了一个fixed的元素,后面的offset都不准了


Firefox // 在请求时,如果网络中断,Firefox会无法取得status   所以要在try...catch中先取得status
0 0
原创粉丝点击