博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
修改zepto源代码,使支持wp8的ie10
阅读量:6860 次
发布时间:2019-06-26

本文共 715 字,大约阅读时间需要 2 分钟。

注意:当前1.1.3版本的zepto,已经有模块来支持wp8

原先的zepto,通过__proto__赋值,来使dom继承到$.fn方法,

无奈IE11之前的IE10,IE9不支持这种写法,

所以我们只能自己手动把方法添加到dom

// `$.zepto.Z` swaps out the prototype of the given `dom` array  // of nodes with `$.fn` and thus supplying all the Zepto functions  // to the array. Note that `__proto__` is not supported on Internet  // Explorer. This method can be overriden in plugins.  zepto.Z = function(dom, selector) {    dom = dom || []    // 支持ie10,主要是支持wp8    if(navigator.userAgent.indexOf("MSIE 10") > -1){      for(var func in $.fn){        dom[func] = $.fn[func];      }    }    else{      dom.__proto__ = $.fn    }        dom.selector = selector || ''    return dom  }

 

转载于:https://www.cnblogs.com/samwu/p/3433117.html

你可能感兴趣的文章
静态方法-类方法-属性方法
查看>>
jQuery实现的全选、反选和不选功能
查看>>
Wireshark匹配指定地址
查看>>
python编写小程序(计算器)
查看>>
C++写的一个MYSQL控制台(2)
查看>>
以实践方式学习LVM磁盘管理
查看>>
Oracle 查询版本号
查看>>
Centos7修改默认启动级别(命令行,图形切换)
查看>>
php 入门笔记
查看>>
INotifyPropertyChanged接口应用示例
查看>>
OC-copy
查看>>
epel源报错怎么解决?
查看>>
网页屏幕缩小到出现水平滚动条后,背景不能100%填充
查看>>
11-python-字符串、列表、元组、字典的作业
查看>>
动态链接库和静态链接库
查看>>
移动web开发适配方案之Rem
查看>>
vue2.0组件的生命周期
查看>>
文件上传并改名
查看>>
带通配符的字符串匹配问题
查看>>
关于学习uCOS-II
查看>>