matches

Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.dom.query

Polyfill for the Element.matches function

Params

  1. elm*-HTMLElement

    The element to check

  2. selector*-String

    The selector to check on the element

Return

  1. -Boolean

    If the element match the selector or not

Example

import { matches } from '@blackbyte/sugar/dom'
if (matches(myCoolHTMLElement, '.my-cool-css-selector')) {
  // the element match the selector
}

Todo

  • testsnormal