It should use `rangeInfo.document` instead of `savedSelection.doc`
It should use
rangeInfo.documentinstead ofsavedSelection.doc