当前位置:网站首页>Shim and Polyfill in [concept collection]
Shim and Polyfill in [concept collection]
2022-07-03 06:53:00 【Alisone_ li】
shim
Is a small class library (lib), Provide independent API, To make up for the compatibility problem that people need to consider when using native languages in different environments .
such as : Use js Native Ajax In operation , Do you use XMLHttpRequest establish xhr object , But in IE8 On , You have to use ActiveXObject, To solve these compatibility problems , At the same time, simplify the operation ,jQuery There is .
jQuery The core idea is : write less,do more! therefore ,jQuery Can be seen as a shim.
polyfill
Is a small class library (lib), It's used to implement native that browsers don't support API Code for .
such as :IE9 The following is not supported html5 Some new labels , have access to HTML5 shim For compatibility ; Older browsers don't support ES6 as well as ES6+ Some new features of , have access to Babel To compile into ES5 Syntax compatible .
The code example is as follows :
if (!window.XMLHttpRequest) { window.XMLHttpRequest = function () { .... } }
Be careful
Native API Code for , It can be called polyfill Class library of , The solution must be in an incompatible environment , Redefinition JS Its own grammar , Will not redefine API.
shim and polyfill
1,shim and polyfill The purpose of is to solve browser compatibility , And provide convenient , This is also a class library (lib) One of the functions of ;
2,shim Contains polyfill, Wider scope , You can redefine API, and polyfill Relatively narrow ,API It must be JS standard ;
边栏推荐
- 学习笔记 -- k-d tree 和 ikd-Tree 原理及对比
- 每日刷題記錄 (十一)
- error C2017: 非法的转义序列
- Software testing learning - day 3
- ssh链接远程服务器 及 远程图形化界面的本地显示
- ROS+Pytorch的联合使用示例(语义分割)
- Numerical method for solving optimal control problem (I) -- gradient method
- The list of "I'm crazy about open source" was released in the first week, with 160 developers on the list
- Software testing assignment - day 3
- Daily question brushing record (11)
猜你喜欢
2022 - 06 - 23 vgmp - OSPF - Inter - Domain Security Policy - nat Policy (Update)
2022-06-23 vgmp OSPF inter domain security policy NAT policy (under update)
The pressure of large institutions in the bear market has doubled. Will the giant whales such as gray scale, tether and micro strategy become 'giant thunder'?
Arctic code vault contributor
EasyExcel
DBNet:具有可微分二值化的实时场景文本检测
Software testing learning - the next day
Journal quotidien des questions (11)
Asynchronous programming: async/await in asp Net
Reading notes of "learn to ask questions"
随机推荐
Numerical method for solving optimal control problem (I) -- gradient method
Golang operation redis: write and read hash type data
JMeter JSON extractor extracts two parameters at the same time
Machine learning | simple but feature standardization methods that can improve the effect of the model (comparison and analysis of robustscaler, minmaxscaler, standardscaler)
Yolov2 learning and summary
SQL implementation merges multiple rows of records into one row
如何迁移或复制VMware虚拟机系统
2022-06-23 vgmp OSPF inter domain security policy NAT policy (under update)
My 2020 summary "don't love the past, indulge in moving forward"
These two mosquito repellent ingredients are harmful to babies. Families with babies should pay attention to choosing mosquito repellent products
Stream stream
HMS core helps baby bus show high-quality children's digital content to global developers
Practical plug-ins in idea
“我为开源打榜狂”第一周榜单公布,160位开发者上榜
Software testing learning - day 3
Asynchronous programming: async/await in asp Net
Floating menu operation
Dbnet: real time scene text detection with differentiable binarization
Basic teaching of crawler code
How matlab modifies default settings