The variables declarations here are chaotic, randomly sorted, instead of being grouped into clusters of related variables. Why not put this declaration just after `backspacePressed` but between `domUtil` and `stringUtil`? 

I'm nitpicking, but code apart from doing the right thing, should also be elegant.