Code refactoring, Qunitjs test integration

Most of the stuff should work now
I've also changed some calls to the event handler to prevent stack size
exception
The current event registration is still a bit confusing and should be
involved
Created 2 simple tests yet to verify the event delegation, more to come