Small JS fixes

realised an old edge bug that I'd fixed on othe projects wasn't fixed here.

Also now trying to use querySelector (faster) unless the browser doesn't know it (old, IE, etc).