JS: Test if an element is visible