dom-ponyfills

DOM ponyfills for closest, matches with d.ts.

Usage no npm install needed!

<script type="module">
  import domPonyfills from 'https://cdn.skypack.dev/dom-ponyfills';
</script>

README

dom-ponyfills

DOM ponyfills for closest, matches with d.ts.

Latest NPM release MIT License

Usage

with NPM

$ npm install --save dom-ponyfills
import { closest, matches } from 'dom-ponyfills';

const matched: boolean = matches( el: Element, selector: string );
const element: Element | null = closest( el: Element, selector: string );