Unbreaking a misuse of JavaScript's ambiguous this