When comparing nodes using .eq(), what exactly is being compared?

Mainly because when I do something like JSON.stringify(node1.toJSON()) === JSON.stringify(node2.toJSON()), because the contents are the same, this will return true, but for some reason node1.eq(node2), it’s false. I just want a better understanding of what makes nodes different besides its contents.


1 Like

Content and markup (type, attributes, and marks).

That’s is stringifying the toJSON methods, not the JSON structure they return, which might be what’s causing this.

oh actually I mistyped, I meant

JSON.stringify(node1.toJSON()) === JSON.stringify(node2.toJSON())

That shouldn’t happen — do you have a code example that reproduces it?