To solve this error, you need to pass the omitChecksum
parameter to the serializeSelection
function. This will prevent the DOM validation. serializeSelection
will return the serialized form of the selection which you can save in DB or cookie.
See the following example:
var selObj = rangy.getSelection();
var sel = rangy.serializeSelection(selObj, true);