Polyfill (programming)

The term is a neologism, coined by Remy Sharp, who required a word that meant "replicate an API using JavaScript (or Flash or whatever) if the browser doesn’t have it natively" while co-writing the book Introducing HTML5 in 2009.

One of the most widely used polyfills, html5shiv,[a] exploits another quirk of IE to work around this bug: calling document.createElement("tagname") for each of the new HTML5 elements, which causes IE to parse them correctly.

It reads the page's stylesheets and replaces any unprefixed properties with their prefixed counterparts recognised by the current browser.

However, the draft spec has undergone a drastic revision to a new (and much more powerful) syntax, which is not yet supported by Flexie.

PIE ("Progressive Internet Explorer") implements some of the most popular missing CSS3 box decoration properties in IE, including border-radius and box-shadow for IE 8 and below, and linear-gradient backgrounds for IE 9 and below.

Douglas Crockford originally wrote json2.js as an API for reading and writing his (then up-and-coming) JSON data format.

ECMAScript 5th Edition ("ES5") brings some useful new scripting features, and since they're syntactically compatible with older JavaScript engines they can mostly be polyfilled by patching methods onto built-in JS objects.

John Dyer's MediaElement.js polyfills support for

In February 2024, the library's domain was acquired by China-based company Funnull and within a few months became part of a supply chain attack.

[14] Alexander Farkas's Webshims Lib aggregates many other polyfills together into a single package and conditionally loads only those needed by the visiting browser.