For the benefit of those visiting this page after lo these many years, this functionality is now implemented in all modern browsers as element.matches
without vendor prefix (except for ms
for MS browsers other than Edge 15, and webkit
for Android/KitKat). See http://caniuse.com/matchesselector.