Bug886331 preserve version selection

This is a regression from the changeset for bug 881629. I have reverted this and extended the old JS-based way of doing this instead.