What is the domain of $x^x$ as a real valued function?

For most purposes (including the hotly debated question of what to make of $0^0$) you can consider any instances of exponentiation $x^y$ (where $x,y$ can stand for expressions) to stand for on of two quite disparate definitions that happen to coincide on the intersection of their domains:

  1. If $y$ designates an integer, then $x^y$ is defined algebraically; recursively by $x^0=1$ and $x^{n+1}=xx^n$ for the case $y\geq0$, and provided $x$ is invertible by $x^{-n}=(x^{-1})^n$ for $y<0$.

  2. In other cases one must assume that $x$ is real and positive, and $x^y$ stands for $\exp(y\ln x)$ (note that I did not write $e^{y\ln x}$, which would result in a circular definition). Here $\exp$ is a perfectly defined function $\Bbb C\to\Bbb C$, so one can allow $y$ to be any complex number (or one could even amuse oneself by taking square matrices for $y$), but $x$ must be restricted to avoid ambiguity of $\ln x$. One can of course extend the definition by making choices for $\ln x$, but using a bare $x^y$ for such cases would be confusing, and also one must be aware that many properties of exponentiation will start to fail.

Given this, the real function $x\to x^x$ can only be defined using the second variant, which justifies taking the domain to be the (strictly) positive reals. One could extend to domain to contain the non-positive integers as well (using the first definition), but mixing the two definitions of $x^y$ in a single usage is generally not a very fruitful idea.