How to determine if an element contains another element