当前位置:网站首页>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 ;
边栏推荐
- Software testing assignment - day 3
- [untitled] 8 simplified address book
- Ruoyi interface permission verification
- Derivation of variance iteration formula
- In depth analysis of reentrantlock fair lock and unfair lock source code implementation
- Notes on the core knowledge of Domain Driven Design DDD
- Climb movie paradise 2021 hot
- Basic teaching of crawler code
- Unittest attempt
- Summary of UI module design and practical application of agent mode
猜你喜欢

2022 cisp-pte (III) command execution

DBNet:具有可微分二值化的实时场景文本检测

The dynamic analysis and calculation of expressions are really delicious for flee

Summary of the design and implementation of the weapon system similar to the paladin of vitality

New knowledge! The virtual machine network card causes your DNS resolution to slow down

Personally design a highly concurrent seckill system

2022 East China Normal University postgraduate entrance examination machine test questions - detailed solution

Summary of UI module design and practical application of agent mode

Software testing learning - day one

ROS+Pytorch的联合使用示例(语义分割)
随机推荐
Yolov1 learning notes
IC_EDA_ALL虚拟机(丰富版):questasim、vivado、vcs、verdi、dc、pt、spyglass、icc2、synplify、INCISIVE、IC617、MMSIM、工艺库
Laravel框架 踩坑(一)
HMS core helps baby bus show high-quality children's digital content to global developers
服务器如何设置多界面和装IIS呢?甜甜给你解答!
C2338 Cannot format an argument. To make type T formattable provide a formatter<T> specialization:
(翻译)异步编程:Async/Await在ASP.NET中的介绍
Personally design a highly concurrent seckill system
RestHighLevelClient获取某个索引的mapping
每日刷题记录 (十一)
熊市里的大机构压力倍增,灰度、Tether、微策略等巨鲸会不会成为'巨雷'?
EasyExcel
These two mosquito repellent ingredients are harmful to babies. Families with babies should pay attention to choosing mosquito repellent products
MySQL installation
【开源项目推荐-ColugoMum】这群本科生基于国产深度学习框架PaddlePadddle开源了零售行业解决方案
Floating menu operation
Integration test practice (1) theoretical basis
Practical plug-ins in idea
Heap sort and priority queue
每日刷題記錄 (十一)