Re-reset the input right after a focus event

It seems recent versions of Chrome/Blink fire the handler first,
and then clear the selection.

Issue #1730
[xml mode] Fix value-less attributes

Issue #902