Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Make Fre work in IE8+ (NOT IE7)

License

NotificationsYou must be signed in to change notification settings

frejs/fre-ie

Repository files navigation

fre + webpack4 + babel7 兼容 IE(IE8+. Not IE7)

Run

yarn start

Use

yarn add webpack-ie8-plugin -D
constIE8=require('webpack-ie8-plugin')plugins:[    ...newIE8()// 配置文件引入 webpack 的 polyfill]import'fre/ie'// 业务入口引入 fre 的 polyfill

动机

目前主流前端框架都不支持 ie,react16 已经不可能支持 ie8 了,vue 更是想都别想

然而 ie8+ 在国内仍有很高的占有率

fre 代码量非常小,没有用到几个高级 API,所以兼容起来十分简单

兼容思路

  • webpack 兼容

webpack 最新版本自身不支持 ie8,所以我们要打补丁,幸运的是,webpack4 高级 API 也不多

Object.definepropertyObject.createFunction.bind

  • fre 兼容

Array.forEachArray.isArrayArray.somePerformance.now

以上是 fre 用到的高级 API,也需要打补丁,幸好也不多

  • text 的处理

重写 createTextNode 为x-text,然后将 textContent 改为innerText

  • 模拟事件

主要是对 addEventListener 和 removeEventListener 的模拟

不足

  • 不能使用 webpack-dev-server

由于 ie8 并不支持 webSocket(webpack 是 eventSource),所以基本上所有的通信插件都用不了

  • 没有并入 fre 主库

fre2 重构会适当照顾到兼容,达到一个极佳的平衡,然后会放到主库里维护

About

Make Fre work in IE8+ (NOT IE7)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp