We were incorrectly assuming that setAttribute() could never fail here, even when passed an invalid name. Found by Domato.