how about simply doing `element.classList.contains(selector)`, maybe `trim` the selector first.