Fixed problem with Element.ELEMENT_NODE undefined on Safari