The "domain" mentioned assumes real numbers only. Apparently the packages mentioned assumes complex numbers.
sqrt(-1) - sqrt(-1) = sqrt(0)
i - i = 0
0 = 0 ...so x=0 satisfies the equation.
If you limit yourself to real numbers, then indeed x=0 is not a solution since sqrt(-1) is not a real number. If one squares both sides of the equation twice as mentioned, then solves the resulting quadratic, x=0 is considered an extraneous solution, unless complex solutions are assumed.