replace parentElement with parentNode for better compatibility