Use parentElement instead of hasParent