operasoftware/browserjs — pull request #10 by twuttke (2013-08-20 03:16:10+00:00)
Title: Clear lastElm when innerHtml is no longer being shadowed

There is a small state bug in the workaround for Twitter's tweet editor.

For example, if you enter some text beyond ASCII 0x80, like "Déjà vu" and then erase it, the box goes into a weird state and doesn't function properly.

I believe it is because once lastElm gets set, it can never be unset. When normal ascii html is then written, it bypasses the update to lastStr, but does not clear lastElm.

One solution is to clear lastElm when new html being written no longer contains any international chars.

Incidentally, does anyone reading this know of a better way Twitter could detect when the IME is engaged? Firefox sends the compositionstart and compositionend events, for example.