Check if an element matches a given selector string