rangy
rangy copied to clipboard
canDeserializeRange() always returns false
In my experience, canDeserializeRange()
returns false even when the dom hasn't changed. Looking at it in the debugger, it looks like an off-by-one error in this code in rangy-serializer.js
:
var result = deserializeRegex.exec(serialized);
var checksum = result[3];
return !checksum || checksum === getElementChecksum(rootNode);
The deserializeRegex has 4 capturing parentheses, so the item we're interested in is result[4]
, not result[3]
. result[3]
includes the brackets, so the test 1234 === '{1234}'
fails.
I see the same thing, even on the serializer demo page.