Skip to content
Permalink
Browse files

Fix Wikipedia link (#10)

  • Loading branch information...
mikemhenry authored and sindresorhus committed Feb 23, 2019
1 parent 528b56f commit 77290a345694119f72e6d13213a7de08a2fcac1a
Showing with 1 addition and 1 deletion.
  1. +1 −1 readme.md
@@ -14,7 +14,7 @@ While polyfills are naughty, ponyfills are pure, just like ponies.

## How are ponyfills better than polyfills?

A [polyfill](https://en.wikipedia.org/wiki/Polyfill) is code that adds missing functionality by [monkey patching](https://en.wikipedia.org/wiki/Monkey_patch) an API. Unfortunately, it usually globally patches built-ins, which affects all code running in the environment. This is especially problematic when a polyfill is not fully spec compliant (which in some cases is impossible), as it could cause very hard to debug bugs and inconsistencies. Or when the spec for a new feature changes and your code depends on behavior that a module somewhere else in the dependency tree polyfills differently. In general, [you should not modify API's you don't own.](https://www.nczonline.net/blog/2010/03/02/maintainable-javascript-dont-modify-objects-you-down-own/)
A [polyfill](https://en.wikipedia.org/wiki/Polyfill_(programming)) is code that adds missing functionality by [monkey patching](https://en.wikipedia.org/wiki/Monkey_patch) an API. Unfortunately, it usually globally patches built-ins, which affects all code running in the environment. This is especially problematic when a polyfill is not fully spec compliant (which in some cases is impossible), as it could cause very hard to debug bugs and inconsistencies. Or when the spec for a new feature changes and your code depends on behavior that a module somewhere else in the dependency tree polyfills differently. In general, [you should not modify API's you don't own.](https://www.nczonline.net/blog/2010/03/02/maintainable-javascript-dont-modify-objects-you-down-own/)

A ponyfill, in contrast, doesn't monkey patch anything, but instead exports the functionality as a normal module, so you can use it locally without affecting other code.

0 comments on commit 77290a3

Please sign in to comment.
You can’t perform that action at this time.