bugfix: Ctrl-A throws error when no selection (#1800)

Tested on Firefox 32, IE 9 and Chrome 37