Cross-browser test for whether or not a DOM element matches a given selector