New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

element-matches-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element-matches-polyfill

Element.matches Polyfill

1.0.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

element-matches-polyfill

Polyfill for Element.matches

Provides a polyfill for Element.forEach() to all Browsers.

Native support

See MDN for more information.

Import

// CommonJS
require('element-matches-polyfill');

// ES6 Modules import / Typescript import
import 'element-matches-polyfill';

Usage

<ul id="birds">
  <li>Orange-winged parrot</li>
  <li class="endangered">Philippine eagle</li>
  <li>Great white pelican</li>
</ul>

<script type="text/javascript">
  var birds = document.getElementsByTagName('li');

  for (var i = 0; i < birds.length; i++) {
    if (birds[i].matches('.endangered')) {
      console.log('The ' + birds[i].textContent + ' is endangered!');
    }
  }
</script>

Keywords

Element

FAQs

Package last updated on 01 Feb 2019

Did you know?

Socket

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.

Install

Related posts