Would you check whether s.elementFromPoint is undefined or not?