Web Components Polyfills
Installations
npm install @webcomponents/webcomponentsjs
Releases
Unable to fetch releases
Developer
webcomponents
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
19.8.1
NPM Version
9.5.1
Statistics
1,146 Stars
4,268 Commits
165 Forks
35 Watching
66 Branches
119 Contributors
Updated on 14 Nov 2024
Bundle Size
124.54 kB
Minified
35.71 kB
Minified + Gzipped
Languages
HTML (61.96%)
JavaScript (28.06%)
TypeScript (9.77%)
CSS (0.21%)
Total Downloads
Cumulative downloads
Total Downloads
56,412,365
Last day
0.8%
38,589
Compared to previous day
Last week
3.7%
204,626
Compared to previous week
Last month
3.3%
864,982
Compared to previous month
Last year
-12.9%
10,462,069
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Web Components Polyfills
Getting Started | Usage | Packages | Roadmap
The Web Components polyfills are a suite of JavaScript libraries that implement Web Components APIs for browsers that don't have built-in support.
If you use Custom Elements, Shadow DOM, or the <template>
element, either
directly or through a library like
LitElement, then you can use these
polyfills to make your app work in older browsers like IE11.
We're also working on polyfills for cutting edge new APIs for Web Components that aren't built into all modern browsers yet, like Shadow Parts and Adopted Stylesheets.
Getting Started
Install the webcomponentsjs
package to get all of the Web Components
polyfills and a loader that automatically downloads only the polyfills each
browser needs:
1npm install --save @webcomponents/webcomponentsjs
Load the polyfills loader before any of your application code:
1<html> 2 <head> 3 <!-- If your application is compiled to ES5, then load this script first. --> 4 <script src="./node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script> 5 6 <!-- Add support for Web Components to older browsers. --> 7 <script src="./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script> 8 9 <!-- Load your application code anytime after loader.js --> 10 </head> 11 <body> 12 <!-- Your custom elements will work in older browsers like IE11. --> 13 <my-custom-element></my-custom-element> 14 </body> 15</html>
For more ways to load the Web Components polyfills, see the webcomponentsjs package.
Usage
The Web Components polyfills handle many usage patterns automatically, but there are certain patterns that require direct interaction with the library:
Setting Custom Properties
-
To set a CSS custom property value imperatively, pass the value to
styleSubtree
. -
To re-compute CSS custom properties after a DOM mutuation that affects the matching condition of a CSS rule containing a custom property (e.g. changing a
class
attribute), callstyleSubtree
.
Registering styles
-
To use a style in the main document that sets or consumes a CSS Custom Property, register it with
addCustomStyle
. -
To use a style in a Custom Element, pass the element's template to
prepareTemplate
before first cloning it. (Note that LitElement and the Polymer Library perform this registration step automatically.)
Packages
This repo is a monorepo. Each package lives under packages/<package>
.
webcomponentsjs
Documentation | Changelog | Issues
Loader and pre-minimized bundles for the full suite of Web Components polyfills.
Most users only need to install this package, but it is also possible to separately install any of the individual polyfills listed below.
custom-elements
Documentation | Changelog | Issues
Polyfill for Custom Elements (MDN, Spec)
template
Documentation | Changelog | Issues
Polyfill for Template Element (MDN, Spec)
shadydom
Documentation | Changelog | Issues
Polyfill for Shadow DOM (MDN, Spec)
shadycss
Documentation | Changelog | Issues
Polyfill for Scoped CSS (Spec)
html-imports
Documentation | Changelog | Issues
Polyfill for HTML Imports (Spec)
Note that HTML Imports are
deprecated
in favor of JavaScript
modules.
As of Chrome 81, HTML Imports are no longer natively supported by any browser.
The current version of the Web Components loader does not automatically
polyfill HTML Imports. Applications that still depend on HTML Imports are
recommended to install @webcomponents/html-imports
and load it separately.
Roadmap
The following APIs are on the roadmap for 2020:
No vulnerabilities found.
Reason
security policy file detected
Details
- Info: security policy file detected: SECURITY.md:1
- Info: Found linked content: SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1
- Info: Found text in security policy: SECURITY.md:1
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: BSD 3-Clause "New" or "Revised" License: LICENSE:0
Reason
Found 12/19 approved changesets -- score normalized to 6
Reason
1 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/changelog.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/webcomponents/polyfills/changelog.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/webcomponents/polyfills/tests.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/webcomponents/polyfills/tests.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/webcomponents/polyfills/tests.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/webcomponents/polyfills/tests.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/webcomponents/polyfills/tests.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/webcomponents/polyfills/tests.yml/master?enable=pin
- Info: 0 out of 7 GitHub-owned GitHubAction dependencies pinned
- Info: 3 out of 3 npmCommand dependencies pinned
Reason
SAST tool is not run on all commits -- score normalized to 2
Details
- Warn: 5 commits out of 23 are checked with a SAST tool
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/changelog.yml:1
- Warn: no topLevel permission defined: .github/workflows/tests.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
75 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x
- Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx
- Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-wm7h-9275-46v2
- Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9
- Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq
- Warn: Project is vulnerable to: GHSA-pfq8-rq6v-vf5m
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-7h8x-wmq2-7mff
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm
- Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574
- Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4
- Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g
- Warn: Project is vulnerable to: GHSA-3j8f-xvm3-ffx4
- Warn: Project is vulnerable to: GHSA-j9fq-vwqv-2fm2
- Warn: Project is vulnerable to: GHSA-pqw5-jmp5-px4v
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-4cpg-3vgw-4877
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-x3m3-4wpv-5vgc
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-25hc-qcg6-38wj
- Warn: Project is vulnerable to: GHSA-cqmj-92xf-r6r9
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-h6q6-9hqw-rwfv
- Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q
- Warn: Project is vulnerable to: GHSA-crh6-fp67-6883
- Warn: Project is vulnerable to: GHSA-28mc-g557-92m7
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-897m-rjf5-jp39
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
4.3
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to @webcomponents/webcomponentsjs
3shape-global-nav
## How to use Install packages ``` npm i 3shape-global-nav @webcomponents/webcomponentsjs ``` Add polyfill import ``` import '@webcomponents/webcomponentsjs/webcomponents-bundle.js'; // or dynamical import '@webcomponents/webcomponentsjs/webcomponents-loa
3shape-global-nav-demo
## How to use Install packages ``` npm i 3shape-global-nav-demo @webcomponents/webcomponentsjs ``` Add polyfill import ``` import '@webcomponents/webcomponentsjs/webcomponents-bundle.js'; // or dynamical import '@webcomponents/webcomponentsjs/webcomponent
@webcomponents/custom-elements
HTML Custom Elements Polyfill
webcomponents.js
webcomponents.js