Bug 853425 - Get rid of innerHTML in Keyboard app

This patch takes care of sanitising innerHTML as per issue https://bugzilla.mozilla.org/show_bug.cgi?id=837740. It makes use of textContent and DocumentFragment in some cases, which also improves the speed of these operations. Some other small fixes in code and comments have been made.

This patch makes https://github.com/mozilla-b2g/gaia/pull/8791 obsolete.