当前位置:网站首页>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 ;
边栏推荐
- MySQL installation
- [5g NR] UE registration process
- golang操作redis:写入、读取hash类型数据
- Chapter 8. MapReduce production experience
- Golang operation redis: write and read kV data
- On the practice of performance optimization and stability guarantee
- scroll-view指定滚动元素的起始位置
- 多个全局异常处理类,怎么规定执行顺序
- Climb movie paradise 2021 hot
- Numerical method for solving optimal control problem (I) -- gradient method
猜你喜欢

这两种驱蚊成份对宝宝有害,有宝宝的家庭,选购驱蚊产品要注意

第8章、MapReduce 生产经验

Ruoyi interface permission verification

The 10000 hour rule won't make you a master programmer, but at least it's a good starting point

golang操作redis:写入、读取hash类型数据

Golang operation redis: write and read hash type data

SQL implementation merges multiple rows of records into one row

熊市里的大机构压力倍增,灰度、Tether、微策略等巨鲸会不会成为'巨雷'?

Journal quotidien des questions (11)

2022年华东师范大学计科考研复试机试题-详细题解
随机推荐
mysql误删root账户导致无法登录
Condition annotation in uni-app realizes cross segment compatibility, navigation jump and parameter transfer, component creation and use, and life cycle function
Golang operation redis: write and read kV data
Example of joint use of ros+pytoch (semantic segmentation)
Software testing learning - the next day
Understand software testing
The list of "I'm crazy about open source" was released in the first week, with 160 developers on the list
Stream stream
La loi des 10 000 heures ne fait pas de vous un maître de programmation, mais au moins un bon point de départ
Scroll view specifies the starting position of the scrolling element
2022-06-23 VGMP-OSPF-域间安全策略-NAT策略(更新中)
【类和对象】深入浅出类和对象
Software testing assignment - day 3
(翻译)异步编程:Async/Await在ASP.NET中的介绍
10000小时定律不会让你成为编程大师,但至少是个好的起点
爬虫代码基础教学
Centos切换安装mysql5.7和mysql8.0
[untitled]
论文笔记 VSALM 文献综述《A Comprehensive Survey of Visual SLAM Algorithms》
Paper notes vsalm literature review "a comprehensive survey of visual slam algorithms"