timdown / rangy

A cross-browser JavaScript range and selection library.
MIT License
2.25k stars 368 forks source link

Unable to serialize browser's native Selection #384

Open saraht129 opened 8 years ago

saraht129 commented 8 years ago

Hi there, thanks for this great library.

I am trying to deserialize the Selection object so I can restore it later, but it seems that the rangy.serializeSelection(sel, checksum, root) method is not working with the native browser's Selection as the parameter.

Below is a snippet of my code:

var selection = window.getSelection();
var serializedSel = rangy.serializeSelection(selection, false, document.getElementById("content"));

And the error I'm getting is: Error in Rangy WrappedSelection module: getNativeSelection(): Parameter must be a Window object or DOM node

Am I missing something here? Thanks a lot.

RichoHan commented 8 years ago

Having the same issue here.

amiraeitan commented 8 years ago

Any updates on this issue? I'm experiencing the same.