FrankKai / FrankKai.github.io

FE blog
https://frankkai.github.io/
362 stars 39 forks source link

WebComponents那些事儿 #259

Open FrankKai opened 2 years ago

FrankKai commented 2 years ago
FrankKai commented 2 years ago

webcomponents-sd.js, webcomponents-cs.js, custom-elements-es5-adaptor.js是什么?

web components的polyfill。

webcomponents-sd.js

sd(Shady DOM ) polyfill

webcomponents-ce.js

ce(Custom Elements) polyfill

custom-elements-es5-adaptor.js

Custom Elements es5适配器。

根据规范,只有 ES6 class可以传递给原生 customElements.define API。因此这是为了兼容不支持es6 class的浏览器去使用web components的polyfill。

polyfill仓库:https://github.com/webcomponents/polyfills