Polyfill (programming): Difference between revisions

Content deleted Content added
Mtjh (talk | contribs)
Reword the opening paragraph to be more lucid.
HTML5 Shiv: Copyedit.
Line 19:
core-js<ref>{{Cite web|url=https://github.com/zloirock/core-js|title = Core-js|website = [[GitHub]]|date = 26 October 2021}}</ref> is one of the most popular<ref>{{Cite web|url=https://www.npmtrends.com/core-js-vs-core-js-pure-vs-es5-shim-vs-es6-shim-vs-airbnb-js-shims-vs-polyfill-library-vs-polyfill-service-vs-js-polyfills|title = Airbnb-js-shims vs core-js vs core-js-pure vs es5-shim vs es6-shim vs js-polyfills vs polyfill-library vs polyfill-service &#124; NPM trends}}</ref> JavaScript [[standard library]] polyfills. Includes polyfills for [[ECMAScript]] up to the latest version of the standard: promises, symbols, collections, iterators, typed arrays, many other features, ECMAScript proposals, some cross-platform [[WHATWG]] / [[W3C]] features and proposals like <code>URL</code>. You can load only required features or use it without global namespace pollution. It can be integrated with [[Babel (compiler)|Babel]], which allows it to automatically inject required core-js modules into your code.
 
=== HTML5 Shiv html5shiv===
 
In IE versions prior to 9, unknown HTML elements like {{tag|section|o}} and {{tag|nav|o}} would be parsed as empty elements, breaking the page's nesting structure and making those elements impossible to style using [[CSS]]. One of the most widely used polyfills, html5shiv,{{efn|The use of the term ''shiv'' here is a pun or mistake on ''shim.''<ref name="introducing276"/>}} exploits another quirk of IE to work around this bug: calling <code>document.createElement("tagname")</code> for each of the new HTML5 elements, which causes IE to parse them correctly. It also includes basic default styling for those HTML5 elements.