Avoid stack overflow when comparing objects with cycles (like DOM Elements)