What is the difference between shim and polyfill in JavaScript Javascriptpolyfillshim?

Source: Internet
Author: User

Original link

In the JavaScript world, there are two words that are often mentioned, that is shim and polyfill, what are they referring to, and what is the difference? In this article, we will briefly give you a brief introduction of their relationship and differences.
Shim

A shim is a library that introduces a new API into an old environment, and is implemented only by means already available in the old environment, Shim sometimes referred to as Shiv, such as the famous HTML5 Compatibility library Html5shiv,github address: https:// Github.com/afarkas/html5shiv.


Polyfill

In October 2010, Remy Sharp published an article on the term "Polyfill" on the blog, a polyfill is a piece of code (or plug-in) that provides the functionality that developers want the browser to provide native support for.

So a polyfill is a shim used in the browser API, we usually do is to check whether the current browser supports an API, if not supported to load the corresponding Polyfill, and then the old and new browser can use this API, The term polyfill comes from a home improvement product Polyfilla

Polyfilla is a British product, in the United States called Spackling Paste (Translator note: Scraping the wall, in China called Putty), remember this: the old browser as a wall with cracks, these polyfill will help us to the wall of the cracks, Also we have a better smooth wall (browser)

What is the difference between shim and polyfill in JavaScript Javascriptpolyfillshim?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.