Fix #12945. Check for .getAttribute so IE9 is happy.