rangy icon indicating copy to clipboard operation
rangy copied to clipboard

canDeserializeRange() always returns false

Open jonbrooks opened this issue 8 years ago • 1 comments

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.

jonbrooks avatar Jun 16 '16 14:06 jonbrooks

I see the same thing, even on the serializer demo page.

srsudar avatar Nov 24 '19 18:11 srsudar