1. element-matches
Super small `Element.matches` fix for older browsers (IE 9+, Edge 12+, Safari, Android browsers)
element-matches
Package: element-matches
Created by: jelmerdemaat
Last modified: Sun, 01 May 2022 01:36:59 GMT
Version: 0.1.2
License: MIT (https://jelmer.mit-license.org/)
Downloads: 138,239
Repository: https://github.com/jelmerdemaat/element-matches

Install

npm install element-matches
yarn add element-matches

Element.matches

GitHub | NPM | @jelmerdemaat

Super small Element.matches fix for older browsers. The only thing this package does is add prefixes for:

  • old IE versions (9+)
  • IE mobile(10+)
  • old Edge versions (12+)
  • Safari (desktop) versions 5 - 7
  • Safari & Chrome for iOS 4.1 - 7.1
  • a number of Android browsers
    • Android 2.2 - 4.4.4
    • UC Browser 11.4
    • Blackberry Browser 7+
    • Samsung Internet 4

See Can I Use data: https://www.caniuse.com/#feat=matchesselector

Usage

Install it and import it in your code:

 npm install --save element-matches
 import 'element-matches';

// Do some matching!
if (document.body.matches('.cool-body')) {
    console.info('Yeay, I am cool!');
}

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin