Note that $\sqrt{-2}/\sqrt{-1}$ does not exist in the reals but that $\sqrt{(-2)/(-1)}=\sqrt2$ does.
Likewise, the domain of $\sqrt{x-5}/\sqrt{x+2}$ is where $x-5\geqslant0$ and $x+2\gt0$ while the domain of $\sqrt{(x-5)/(x+2)}$ is where $(x-5)(x+2)\geqslant0$ and $x+2\
e0$.