Input and select handling revamped

Should be much more robust now, doesn't do any unnecessary updates,
works under IE8 (minor cleanup remains).