check nodetype before matching selector