Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@oddbird/popover-polyfill
Advanced tools
This polyfills the HTML popover
attribute and showPopover
/hidePopover
methods onto HTMLElement.
The simplest, recommended way to install the polyfill is to copy it into your project.
Download popover.js
(or popover.min.js
) from
unpkg.com and add it
to the appropriate directory in your project. Then, include it where necessary
with a <script>
tag:
<script src="/path/to/popover.min.js" type="module"></script>
Or without JavaScript modules:
<script src="/path/to/popover.iife.min.js"></script>
You will also likely need the CSS file, which supplies some default styles.
Download popover.css
from
unpkg.com and add it
to the appropriate directory in your project. Then, include it where necessary
with a <link rel=stylesheet>
tag:
<link rel="stylesheet" src="/path/to/popover.css" />
Note that default styles will not be applied to shadow roots. Each root node will need to include the styles separately.
For more advanced configuration, you can install with npm:
npm install @oddbird/popover-polyfill
After installing, you’ll need to use appropriate tooling to use
node_modules/@oddbird/popover-polyfill/dist/popover.js
.
You will also likely need to include the CSS stylesheet which is found in
node_modules/@oddbird/popover-polyfill/dist/popover.css
.
If you want to manually apply the polyfill, you can instead import the
isSupported
and apply
functions directly from
node_modules/@oddbird/popover-polyfill/dist/popover-fn.js
file.
For prototyping or testing, you can use the npm package via a Content Delivery Network. Avoid using JavaScript CDNs in production, for many good reasons such as performance and robustness.
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@oddbird/popover-polyfill@latest/dist/popover.css"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/@oddbird/popover-polyfill@latest"
crossorigin="anonymous"
defer
></script>
After installation the polyfill will automatically add the correct methods and attributes to the HTMLElement class.
Visit our contribution guidelines.
FAQs
Popover Attribute Polyfill
The npm package @oddbird/popover-polyfill receives a total of 43,986 weekly downloads. As such, @oddbird/popover-polyfill popularity was classified as popular.
We found that @oddbird/popover-polyfill demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.