matches

fun matches(selectors: String): Boolean(source)

The matches() method of the Element interface tests whether the element would be selected by the specified CSS selector.

MDN Reference