https://github.com/capricorn86/web-component-slotchange-polyfill
A polyfill for the slotchange event that is part of the web component standard
https://github.com/capricorn86/web-component-slotchange-polyfill
Last synced: 7 months ago
JSON representation
A polyfill for the slotchange event that is part of the web component standard
- Host: GitHub
- URL: https://github.com/capricorn86/web-component-slotchange-polyfill
- Owner: capricorn86
- License: mit
- Created: 2019-08-01T10:36:38.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T08:33:40.000Z (almost 3 years ago)
- Last Synced: 2025-01-23T12:09:38.311Z (9 months ago)
- Language: JavaScript
- Size: 501 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Slot Change Polyfill
This is a polyfill for the "slotchange" event fired on an slot element when the node(s) contained in that slot change.Read more about the "slotchange" event [here](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/slotchange_event).
# How to Install
```bash
npm install web-component-slotchange-polyfill
```# Usage
This polyfill should be added last as it is dependent on other polyfills like custom-elements to be loaded.
### Include as a package
*Note! The bellow file can be found here: node_modules/web-component-slotchange-polyfill/lib/slotchange-polyfill.min.js.*
```html
```
### Include as a module
```javascript
require('web-component-slotchange-polyfill');
```# Configuration
### Example
```html
window.slotChangePolyfill = {
// Forces the polyfill to be loaded
force: false
};```
### Options
| Name | Type | Default | Description |
| ----- | ------- | ------- | ------------------------------------------------------------ |
| force | boolean | false | Forces the polyfill to be loaded even if the browser has native support. |# Known Limitations
If multiple slots are used, all event listeners will be fired even if only one slot is changed.# Release Notes
| Version | Date | Description |
| ------- | ---------- | --------------------------------------------------- |
| 0.0.2 | 2019-10-30 | Updates eslint to fix security vulnerability. |
| 0.0.1 | 2019-07-30 | Alpha release. |# How to Develop
### Installation
```bash
npm install
```### Compilation
```bash
npm run compile
```### Run watcher
```bash
npm run watch
```