Skip to content

shgysk8zer0/polyfills

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@shgysk8zer0/polyfills is a collection of JavaScript polyfills designed to provide modern functionality in older browsers. This library provides a range of polyfills for features including AbortSignal, CookieStore, Sanitizer, and many more.

CodeQL Node CI Lint Code Base

GitHub license GitHub last commit GitHub release GitHub Sponsors

npm

NPM Unpacked Size npm

GitHub followers GitHub forks GitHub stars Twitter Follow

Donate using Liberapay


Installation

You can access @shgysk8zer0/polyfills in several ways:

CDN

You can use a CDN to access the library. Add the following script tag to your HTML file to load the latest version:

<script src="https://unpkg.com/@shgysk8zer0/polyfills[@version]/all.min.js"></script>

With version and SRI

<script src="https://unpkg.com/@shgysk8zer0/[email protected]/all.min.js" referrerpolicy="no-referrer" crossorigin="anonymous" integrity="sha384-xoY6kDRPTvbDfGdGA3S6Ercudev5mWGBWZIErLB38f7TeN6hV7zof6WBpzMdx/z0" fetchpriority="high" defer=""></script>

NPM

You can install the library as an NPM package and use it in your project. Use the following command to install the library:

npm install @shgysk8zer0/polyfills

Note

If using this polyfills package in a node environment, you want to use node.js instead of all.js. The node version omits polyfills that do not make sense in NodeJS, such as DOM. Simply using import '@shgysk8zer0/polyfills' or require('@shgysk8zer0/polyfills') should work.

Git Submodule

You can add the library as a Git submodule to your project. Use the following command to add the library as a submodule:

git submodule add https://github.com/shgysk8zer0/polyfills.git [:path/to/destination]

Usage

To use the polyfills in your project, simply import them using ES6 modules:

import '@shgysk8zer0/polyfills';
// Or
import 'https://unpkg.com/@shgysk8zer0/polyfills/all.js';

This will load all the polyfills in the library.

If you only need certain polyfills, you can import them individually:

import '@shgysk8zer0/polyfills/sanitizer.js';
import '@shgysk8zer0/polyfills/trustedTypes.js';
import '@shgysk8zer0/polyfills/elementInternals.js';

Import Map

You can avoid installing altogether while keeping the familiar syntax by using an import map. If you use Rollup, see @shgysk8zer0/rollup-import. for more details.

<script type="importmap">
{
  "imports": {
    "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/[email protected]/all.min.js",
    "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/[email protected]/",
  }
}
</script>

Contributing

If you would like to contribute to the library, please follow these steps:

  1. Fork the repository.
  2. Create a branch for your changes.
  3. Make your changes.
  4. Submit a pull request.

Please make sure that your changes are thoroughly tested and that they follow the same coding style as the rest of the library.

License

@shgysk8zer0/polyfills is licensed under the MIT license. See the LICENSE file for more details.