Make event handling more flexible.

Rather than forcing a state-change behaviuor on the user (rely on CSS)
and only allow him to select the class names, this patch allows the user
to decide exactly what happens on state change.

The requirement for classes to be added to the input no longer exists