Javascript onChange event and IME

But wait! What happens when I use Chinese input? ...types CTRL+Space and start composing... Oh shit!~ [1]

Capturing key strokes is nice, but it does not support virtual keyboard like on tablet or smartphones and more advanced input methods such as Chinese/Japanese or other writing systems.

The problem that arises very fast is that those input methods actually trigger events while composing.

Meet the compositionStart, compositionUpdate, and compositionEnd events

There are special events to know when an input method started, and ended. See [2].

Because an example is worth thousands words, [3].

Demo