Save old value before triggering the "activate" event, add "ready" event

In my opinion, the old value should be saved before triggering the "activate" event, not after it. This way, when the user aborts editing, the original value will be restored even if the "activate" event changes the value. Similarly, the input field or textarea should contain the current value (i.e. including changes made by the "activate" event) of the element instead of the original one.

I planned to make another pull request for the other change I made but failed separating them. :( Therefore this pull request contains the other change as well: an event called "ready" will be triggered when the input field or textarea is ready. That will allow applications to edit the style of the field or textarea dynamically.