Can you do a check for parentNode's existence:

`if parentElement?.href`