0.0.3 • Published 5 years ago

web-component-slotchange-polyfill v0.0.3

Weekly downloads
14
License
MIT
Repository
github
Last release
5 years ago

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.

How to Install

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.

<script src="slotchange-polyfill.min.js"></script>

Include as a module

require('web-component-slotchange-polyfill');

Configuration

Example

<script>
    window.slotChangePolyfill = {
        // Forces the polyfill to be loaded
        force: false
    };
</script>
<script src="slotchange-polyfill.min.js"></script>

Options

NameTypeDefaultDescription
forcebooleanfalseForces 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

VersionDateDescription
0.0.22019-10-30Updates eslint to fix security vulnerability.
0.0.12019-07-30Alpha release.

How to Develop

Installation

npm install

Compilation

npm run compile

Run watcher

npm run watch