Let $A\subseteq X$ is dense in $X$ and $B \subseteq Y$ is dense in $Y$, where X and Y are Hausdorff spaces. If a continuous function $f\colon X \rightarrow Y$ satisfies that its restriction to $A$ is a bijective map from $A$ to $B$. Then, does it imply that function $f$ itself is onto?
I have resolved this problem in the special case in which $X$ is assumed to be compact and I feel that it is a general result but not getting how to argue. And can we assume restriction map above is just onto?