Consider attributes when matching elements