Note. For polyfills that work with the older Custom Elements and Shadow DOM v0 specs, see the v0 branch of the webcomponentsjs repo.
Note. For polyfills that work with HTML Imports, see the v1 branch of the webcomponentsjs repo.
A suite of polyfills supporting the Web Components specs:
- Custom Elements v1: allows authors to define their own custom tags (spec, tutorial, polyfill).
- Shadow DOM v1: provides encapsulation by hiding DOM subtrees under shadow roots (spec, tutorial, shadydom polyfill, shadycss polyfill).
For browsers that need it, there are also some minor polyfills included:
HTMLTemplateElement
Promise
Event
,CustomEvent
,MouseEvent
constructors andObject.assign
,Array.from
(see webcomponentsjs)URL constructor
The entire WebComponents suite can be installed at once and loaded together for maximum compatibility.
More information about how the polyfill bundles, and feature-detecting loader work are in the webcomponentsjs README.
Individual polyfills can be installed with the @webcomponentsjs/
scope
npm install @webcomponents/custom-elements
Shadow DOM with ShadyCSS
Note: This polyfill requires manual setup and API calls for style encapsulation
npm install @webcomponents/shadydom @webcomponents/shadycss
npm install @webcomponents/template
⚠️ HTML Imports has been deprecated, and will be removed from Chrome in the future. Please transition to ES Modules!⚠️
npm install @webcomponents/html-imports
npm install
npm run bootstrap
npm run build
npm run build
npm test