Frontend "black talk" polyfill, "black talk" polyfill
Preface
In the ever-changing era of Web Front-end development, you always need to read some of the latest English technology blogs to keep up with the technology development trend. Sometimes you may encounter some frequently-used "Black quotes", which may already be a common language in the community, but you cannot understand it if you have little contact with it. Just like almost all Chinese now know what duang is, but a foreigner who just learned Chinese may be confused after seeing it.
Black talk also needs to be learned. This article collects various black talk about Web development. Here we will first introduce two.
Polyfill
Polyfill or Polyfiller is a British Web developer, Remy Sharp, shoot his head in a coffee shop. At that time, he wanted to use a word to describe "using JavaScript (or something like Flash) to implement native APIs not supported by browsers ". Shim, an existing word, appears in his mind for the first time. But he looked back and thought that Shim generally has its own API, instead of simply implementing an API that is not supported by native. He had never thought of a proper word, so he made a word Polyfill in anger. In addition to the word he used, he also used it for other developers. As he frequently mentioned this word in various Web conference speeches and the book Introducing HTML5 he wrote, everyone thought it was good and used it together.
The exact meaning of Polyfill is:Code used to implement native APIs not supported by the browser.
For example, querySelectorAll is a native Web API supported by many modern browsers, but some old Browsers Do not. If someone writes a library, you only need to use this library, you can use document in an old browser. querySelectorAll is used in the same way as the native API of modern browsers. This library can be called Polyfill or Polyfiller.
Okay, then the problem arises. Is jQuery A Polyfill? The answer is No. Because it does not implement some standard native APIs, it encapsulates its own APIs. A Polyfill is used to flat old and new browsers.Standard native APIAn encapsulation of the gap, rather than implementing your own API.
The existing Polyfill, such as Polymer, allows the old browser to use a Polyfill of HTML5 Web Component. FlashCanvas is implemented in Flash so that the Canvas Polyfill can be used in browsers that do not support the Canvas API.
S
Him and
P
Olympus
In the JavaScript world, two words are often mentioned. What are the meanings of shim and polyfill?
OneShim is a library that introduces a new API to an old environment and is implemented only by the existing methods in the old environment..
A polyfill is a shim used in browser APIs. we usually check whether the browser supports an API first. If not, load the corresponding polyfill. then the New and Old browsers can use this API. the term polyfill comes from a home decoration product Polyfilla:
Polyfilla is a British product called Spackling Paste in the United States ).
Remember this: think of the old browser as a wall with cracks. these [polyfills] will help us flat the cracks on the wall and provide us with a better smooth wall (browser)
Paul Irish published a summary page of Polyfills, "HTML5 Cross Browser Polyfills ". es5-shim is an example of a shim (rather than polyfill) that implements New Features of ECMAScript 5 on the ECMAScript 3 engine and on the Node. js has exactly the same performance as that on the browser. js, not only on the browser, so it is not polyfill ).