Improve cross browser DOM element detection