Gathering detailed insights and metrics for @webcomponents/webcomponentsjs
Gathering detailed insights and metrics for @webcomponents/webcomponentsjs
Gathering detailed insights and metrics for @webcomponents/webcomponentsjs
Gathering detailed insights and metrics for @webcomponents/webcomponentsjs
Web Components Polyfills
npm install @webcomponents/webcomponentsjs
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,146 Stars
4,268 Commits
165 Forks
35 Watching
66 Branches
119 Contributors
Updated on 14 Nov 2024
Minified
Minified + Gzipped
HTML (61.96%)
JavaScript (28.06%)
TypeScript (9.77%)
CSS (0.21%)
Cumulative downloads
Total Downloads
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
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.
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.
The Web Components polyfills handle many usage patterns automatically, but there are certain patterns that require direct interaction with the library:
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), call styleSubtree
.
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.)
This repo is a monorepo. Each package lives under packages/<package>
.
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.
Polyfill for Custom Elements (MDN, Spec)
Polyfill for Template Element (MDN, Spec)
Polyfill for Shadow DOM (MDN, Spec)
Polyfill for Scoped CSS (Spec)
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.
The following APIs are on the roadmap for 2020:
No vulnerabilities found.
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
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
Reason
SAST tool is not run on all commits -- score normalized to 2
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
75 existing vulnerabilities detected
Details
Score
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 More3shape-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