Exactly who popularized the modern definition of domain and codomain of functions? In Whitehead and Russell's Principia, domain is the referents of relation; converse domain is the relata.  Modern function in mathematics is just one special case of relation whose referent is unique when the relatum is given. 
I notice that what is called in modern function "domain" is called "converse domain" in PM, and what is called "codomain" in modern function is actually called "domain" in PM. Because I am so used to modern concept, PM section D become unnecessarily difficult for me.
What's more astonishing is that y in PM takes the place of x (arguments) in modern math, and x in PM takes the place of y (value of a function). Coincidence beyond a point is impossible. If the person who made this twist does not have a good reason, I cannot rule out malice.
Russell knew fully well about the relation between habits and intelligence. If the convention existed before PM, Russell would never have redefined it backwards. 
 A: I've made some research, but I've found few elements.
I think that the source for codomain is PM's usage of converse domain.
Note (October 2016) : thanks to Bram28 for an early source from Cassius Jackson Keyser's Mathematical Philosophy, a Study of Fate and Freedom (1922), page 168 :

A relation $R$ has what is called a domain, - the class of all the terms such that each of them has the relation to something or other, - and also a codomain - the class of all the terms such that, given any one of them, something has the relation to it.


In Alonzo Church, Introduction to Mathematical Logic (1956), page 316, footnote 517, we have :

The domain of a relation is the class of things (individuals) which bear that relation
to at least one thing; and the converse domain of a relation is the class of things to which at least one thing bears that relation. (The converse domain of a relation is thus the same as the domain of the converse of the relation, where "converse" has the meaning
explained [above].)

In Nicolas Bourbaki, Théorie des ensembles, page II.10 speaks of :

"est appelé l'ensemble de définition (ou domaine) [...] L'ensemble des objets qui correspondent par $G$ [graphe] à des éléments de $X$ s'appelle l' image

The english translation (1957) of Felix Hausdorff, Set theory (german ed 1937), page 16, speaks only of :

Let $Ρ$ be a set of ordered pairs $p = (a, b)$ ; for every pair $p$ that occurs in $P$ $(p \in Ρ)$, we call $b$ an image of $a$ and $a$ a pre-image (or inverse image) of $b$.

Paul Bernays, Axiomatic set theory (1958), page 609 :

Relations can be reduced to classes by means of the concept of the ordered pair. [...] If $A$ is a pairclass [i.e.a set of ordered pairs] then $\Delta_1 Α$ ($\Delta_2 Α$) is its «domain» («converse domain»).

Paul Halmos, Naive Set Theory (1960), page 27 :

In the theory of relations these sets are known as the domain and the range of $R$ (abbreviated dom $R$ and ran $R$)

Patrick Suppes, Axiomatic Set Theory (1960), page 58, use domain and range of a relation $R$.
JDonald Monk, Introduction to Set Theory (1969), page 21 :

$Dmn R = \{ x : \exists y [(x,y) \in R] \}$. $Dmn R$ is called the domain of $R$.
$Rng R = \{ y : \exists x [(x,y) \in R] \}$. $Rng R$ is called the range of $R$.


Note - expanded April, 20.
W&R's usage of domain and converse domain is not different from "modern" one; see page 33-34 :

The class of all terms that have the relation $R$ to something or other is called the domain of $R$. Thus if $R$ is the relation of parent and child, the domain of $R$ will be the class of parents. We represent the domain of $R$ by "$D‘R$" Thus we put

$D‘R = \hat x \{\exists y . xRy \}$ Df.


Indeed there is a difference, but one of (so to say) "style" only. See page 31 :

"$R‘y$" meaning " the object having the relation $R$ to $y$." [...] Thus if $R$ is the relation of father to son, $"R‘y$" means "the father of $y$". [...] Thus in our notation, "sin $y$" would be written "sin $‘y$" and "sin" would stand for the relation which sin $‘y$ has to $y$.

We are accustomed to symbolizing mathematical functions $f(x)=y$, where $x$ "range over" the domain of definition of the function and $y$ "span over" the codomain. In the "sin", we usually think to the graph of the trigonometric function $sin(x)$, where $x$ is the abscissa.
In PM, page 31, R&W use two examples of a (binary) relation R : the relation of son to father ("$x$ is the father of y") and the relation "$x$ is the sin of $y$"; in this second example, compared to usual mathematical usage, they have "exchanged the roles" of $x$ and $y$: if we "plot" the graph of this relation, the $y$ is the abscissa, while $x$ will describe the function sin.
Taking into account this particular choice of the symbols, consider page 32 :

If the function in question is "$R‘y$", its domain of definition or of existence will be
the class of those arguments $y$ for which we have $\exists ! R‘y$, i.e. for which $\exists ! (\iota x) (xRy)$, i.e. for which there is one $x$, and no more, having the relation $R$ to $y$.

Thus, if we apply it to sin, we have that its domain of definition will be the class of those arguments $y$ for which there is one $x$, and no more, having the relation sin to $y$, i.e.for which there is one and only one $x$ such that $x$ is the sin of $y$, i.e. $x= sin(y)$.
And this is no more nor less than "our" use of domain.
This is perfectly consistent with the definition of converse domain "$\hat y \{ \exists ! R‘y \} = D_C‘R$" [where I use $D_C$ in place of the "inverted-D"]. See page 34 :

the class of all terms to which something or other has the relation $R$ is called the converse domain of $R$; it is the same as the domain of the converse of $R$.

But in our example, the relation is "$x$ is the sin of $y$" where $y$ is the argument which "range over" the domain. Thus $x$ is the value of the function $x=sin(y)$, which spans over the converse domain.
A: I disagree with some of the posts here that say that the old usages of 'domain' and 'co-domain' map on our modern usages of those terms.
Compare:
Russell and Whitehead, PM, 1915, page 34 :

the class of all terms to which something or other has the relation $R$ is called the converse domain of $R$; it is the same as the domain of the converse of $R$.

Cassius Keyser, Mathematical Philosophy, 1922, page 168:

A relation $R$ has what is called a domain, - the class of all the terms such that each of them has the relation to something or other, - and also a codomain - the class of all the terms such that, given any one of them, something has the relation to it. 

Well, it seems to me that they are talking about the exact same thing. That is, when Keyser talks about a 'codomain', he is talking about the same thing as Russell and Whitehead's 'converse domain'.
But note that the way these two texts talk about the 'codomain' is what we now call the 'range', and not what we now call the 'co-domain'. So I think there has been a shift ... 
... and as I see it: not for the better! I have seen many students get confused about the modern usage of domain, range, and co-domain ... and I think it is because 'domain' and 'co-domain' are no longer each others' 'converse' or 'inverse', while, confusingly, the 'domain' and 'range' are!
Here is my dream:
It would be nice if we start any treatment of functions by saying: "ok, we have a function that we want to map from this structure of objects to this other structure objects (possibly the same structure) ...".  This setup provides the 'frame' or 'context' of the function .... it tells them what to use for their $x$ and $y$ axes ... it tells the students what we're talking about in the first place ... Indeed, if it were up to me, I would call these the 'domain of discourse' and 'co-domain of discourse'.
I sometimes see as an exercise that students have to figure out the domain, range, and co-domain of a function like $f(x) = x^2$ ... Well, how is one supposed to do that if it is not specified whether we are talking about the real numbers, natural numbers, complex numbers, or...? So making clear what it is you are talking about, i.e. what a function is supposed to work with, would be super helpful.  But we don't seem to have a term for that in modern math .. our 'domain' is already restricted to exactly those values that the function can actually work with. .. and I have no idea how one would be supposed to figure out what those values would be if one is not given some initial restriction like "we're talking about the integers here ...".
Anyway, once it's establish what a function is intended for, we can then continue with: "OK, here is the formula of the specific function we want to analyze ... let's see which input values the function can take, and which output values the function can deliver". And that we call the 'domain of definition' and 'co-domain of definition' respectively.  Nicely symmetrical, nicely logical, nicely conceptual, and nicely rhetorical. Unlike the modern usage of terms ...
As an example, suppose I have a function $f(x) = 1/x$.  I would like to say something like that the 'domain of discourse', as well as its 'co-domain of discourse', are the set of all real numbers (as opposed to, say, the set of complex numbers) while its 'domain of definition', as well as its 'co-domain of definition', is the set of all real numbers except $0$. 
A: In Introduction to Mathematical Philosophy, Russell says "The converse domain of a relation is the domain of its converse.", where "domain" is the same as in the modern version, and this obviously correlates with what appears in PM. The confusion here might arise from "converse" used both in the context of "converse relation" and "converse domain". Maybe "co-" comes from "converse" so "co-domain" is the short name for "converse domain. In the case of a function we then also use domain/co-domain or domain/range, or other namings, but we may note that Newton (and Menger refers to Newton) separates objects (in the domain) from values (in the range), so y = f(x) is really logically a substitution, where the type of elements in the domain may be different from the type of elements in the range. All these aspects are seemingly harmless, even if they something create unnecessary debate as we see above, but a fundamental question is really if a function is a special case of a relation or if it is something beyond. The reason to say so is that a relation r : X x Y -> 2 can equivalently be written as a function r* : X -> PY, where P is the powerset operator (functor if we speak with the language of category theory). Now, if X and Y are typed (same or different type), the type of PY is unclear. It is intuitively a "powertype" but type theory is unable to describe this. 
