Can an ideal in a commutative integral domain be its own square?
$\rm\:I^2\! = I\:\Rightarrow\: I = (0)\:$ or $\rm\:I = (1)\:$ in Noetherian domains: $ $ see see here for a simple proof of this.
Theorem. $\ $ Suppose that $\rm\:I\:$ is a finitely generated idempotent ideal of a commutative ring. Then the ideal $\rm\:I\:$ is principal $\rm\:I = (e),\:$ with $\rm\:e\:$ idempotent, i.e. $\rm\:e^2\! = e.$
However, in non-Noetherian domains there can exist nontrivial idempotent ideals. For example, consider the ideal $\rm\: I = (2^{1/2},2^{1/4},2^{1/8},\ldots)\:$ in the ring $\rm\,R\,$of all algebraic integers. Set ${\rm t_i}=2^{1/2^i}$. Note that $\rm\: I = (t_i) = (t_{i+1}^2) \subseteq I^2,\:$ so $\rm\:I^2\! = I,\:$ since the reverse $\rm\:I\supseteq I\ \!R \supseteq I^2$ always holds. $\rm\:I\ne (1)\:$ else $\rm\: r_n t_n + \cdots + r_1 t_1 = 1\:$ $\Rightarrow$ $\rm\:t_n\mid 1,\:$ contradiction, by $\rm\:t_n\!\mid t_{n-1}\!\mid\cdots \mid t_1\,$ by $\rm\: t_{i+1}\!\mid t_i\! = t_{i+1}^2$.
See also J. T. Arnold and R. Gilmer, Idempotent ideals and unions of nets in Prufer domains.
Let $D$ be the subalgebra of $k(x, y)$ generated by the sequence of rational functions
$$x_1 = x$$ $$x_2 = y$$ $$x_n = \frac{x_{n-2}}{x_{n-1}}$$
and let $I = (x_1, x_2, x_3, ...)$. By construction, $x_n = x_{n+1} x_{n+2}$, so every element of $I$ is an element of $I^2$, and $D$ is a subring of a field, hence an integral domain. $I$ is proper since $D/I \cong k$ and is nonzero since it consists of nonzero elements of a field.