add check to see if parentNode exists before trying to get dims