Rectangle 27 244

Call it shims if you want to keep the directory generic. A polyfill is a type of shim that retrofits legacy browsers with modern HTML5/CSS3 features usually using Javascript or Flash. A shim, on the other hand, refers to any piece of code that performs interception of an API call and provides a layer of abstraction. It isn't necessarily restricted to a web application or HTML5/CSS3.

terminology - What is the difference between a shim and a polyfill? - ...

terminology naming vocabulary polyfills shim
Rectangle 27 244

Call it shims if you want to keep the directory generic. A polyfill is a type of shim that retrofits legacy browsers with modern HTML5/CSS3 features usually using Javascript or Flash. A shim, on the other hand, refers to any piece of code that performs interception of an API call and provides a layer of abstraction. It isn't necessarily restricted to a web application or HTML5/CSS3.

terminology - What is the difference between a shim and a polyfill? - ...

terminology naming vocabulary polyfills shim
Rectangle 27 55

  • A shim is a library that brings a new API to an older environment, using only the means of that environment.

terminology - What is the difference between a shim and a polyfill? - ...

terminology naming vocabulary polyfills shim
Rectangle 27 55

  • A shim is a library that brings a new API to an older environment, using only the means of that environment.

terminology - What is the difference between a shim and a polyfill? - ...

terminology naming vocabulary polyfills shim
Rectangle 27 3

A fantastic article written about this from a few years back that explains this well:

In the article the (2) are simply contrasted as such:

Shim: a piece of code that you could add (i.e. JavaScript) that would fix some functionality, but it would most often have it's own API.

Polyfill: something you could drop in (i.e. JavaScript) and it would silently work to mimic existing browser APIs that are otherwise unsupported.

I think this is a misleading representation of both the common usage and what Remy Sharp actually says in blog post you've linked to. Shim is most often used synonymously with polyfill nowadays (see particularly the es5-shim and es6-shim) and Remy is particular about saying that to him the word 'shim' alluded to a custom API (by comparison with shim.gif). He is very much not dictating that the words be used in this way, and by saying "to me" he is tacitly acknowledging that his usage is not universal.

terminology - What is the difference between a shim and a polyfill? - ...

terminology naming vocabulary polyfills shim
Rectangle 27 3

A fantastic article written about this from a few years back that explains this well:

In the article the (2) are simply contrasted as such:

Shim: a piece of code that you could add (i.e. JavaScript) that would fix some functionality, but it would most often have it's own API.

Polyfill: something you could drop in (i.e. JavaScript) and it would silently work to mimic existing browser APIs that are otherwise unsupported.

I think this is a misleading representation of both the common usage and what Remy Sharp actually says in blog post you've linked to. Shim is most often used synonymously with polyfill nowadays (see particularly the es5-shim and es6-shim) and Remy is particular about saying that to him the word 'shim' alluded to a custom API (by comparison with shim.gif). He is very much not dictating that the words be used in this way, and by saying "to me" he is tacitly acknowledging that his usage is not universal.

terminology - What is the difference between a shim and a polyfill? - ...

terminology naming vocabulary polyfills shim
Rectangle 27 0

According to this Github page the shims include all monkey-patches that faithfully represent the ES5 features.

In other words: you can use the features provided by these files as if you were using ES5 proper.

The shams, however contain those features that can not be emulated with other code. They basically provide the API, so your code doesn't crash but they don't provide the actual functionality.

Which ones do you need? That depends on how you write your code. If you only use features provided by the shims, then include that. If you also want to (optionally) use features from the shams, then you need both of them.

The Wikipedia page on polyfills describes it in a pretty succinct fashion as well.

Thanks. Here is what I gather from the two sources mentioned above: From ES5 github repo... "In many cases, this means that these shams cause many ES5 methods to silently fail. Decide carefully whether this is what you want." From wikipedia... "es5-sham.js contains partial implementations of the other methods which rely too much on the underlying engine to work accurately." I can also see which features are supported by the sham/shim in the repo. What would be even more helpful, is if someone knows which features normally supported by the shim will break when adding the sham.

I haven't tried that specifically, but if anything in the shams broke anything in the shims I'd consider that a bug.

javascript - Shim vs. Sham: What is the difference? - Stack Overflow

javascript ecmascript-5 ecmascript-6 polyfills
Rectangle 27 0

Call it shims if you want to keep the directory generic. A polyfill is a type of shim that retrofits legacy browsers with modern HTML5/CSS3 features usually using Javascript or Flash. A shim, on the other hand, refers to any piece of code that performs interception of an API call and provides a layer of abstraction. It isn't necessarily restricted to a web application or HTML5/CSS3.

terminology - What is the difference between a shim and a polyfill? - ...

terminology naming vocabulary polyfills shim