First, here are a couple of related, but not-quite-the-same questions:
- Should I include dependencies for which I have the source as projects in my solution?
- Depending on another open source library: copy/paste code or include
Now on to my particular question:
This polyfill is:
- Available: Copy-pasteable code snippets of variants of it are all over the place.
- Tiny: It's only a few lines of code, really.
- Endemic: Libraries in the same problem space as mine may have it bundled already.
Obviously, if my library were the only library being used in someone's project, and if part of that code could fail without the polyfill in circumstances likely for the developer's audience, it would make sense to bundle the polyfill with the library.
requestAnimationFrame for the second, third, fourth time over. (This itself isn't really an issue, since most polyfills by their very nature include a pre-check of the namespace. But, I admit, the thought of the same polyfill appearing multiple times in someone's code bothers me like a painting hung slightly crooked.)
So what is the sensible thing to do? Include it? Or just leave a note in the documentation that says, "By the way, make sure you have the Polyfill X if you need to support Browser Y"?