* use event delegating and reset event on viewStateChange to fix adding the same click event again and again after the event is thrown
* make jshint happy