Q:

Continuous invariants of topological spaces

I would like some clarification on exactly what a 'continuous invariant' of topological spaces is.   My book does not give a straight definition but rather just says "Properties preserved by continuous functions are called continuous invariants."   It motivates this with the theorem that states "Let $X$ be a connected space and $f:X \to Y$ a continuous function from $X$ onto a space $Y$.  Then $Y$ is connected." 
In this case, the 'onto' part of the above theorem is necessary.   For example, take a map $f:\mathbb{R} \to X : x \mapsto a$ where $a$ is a fixed point in $X$ and $X$ is a discrete space with at least 2 points.   Then this constant function is continuous but $X$ is not connected, since no discrete space with at least two points is. 
My question is: Is the 'onto' part of the theorem above part of the general definition of a continuous invariant?   Does a continuous invariant carry over to the codomain of a continuous map that isn't surjective, or only to its image?   What is the (or a) formal definition for "continuous invariant"? 

A:

Yes, the onto is understood.  A property $P$ of topological spaces is a continuous invariant if whenever $X$ has $P$ and $f:X\to Y$ is a continuous surjection, then $Y$ has $P$. The idea is that $f$ carries the property from $X$ as a whole to $Y$ as a whole.