Fixed a bug for browsers not supporting element.parentElement