I was trying to make a Chrome extension that lets me highlight parts of a webpage and then store these highlights in browser storage. These highlights should be available when I revisit the page.
I wrote a function that takes in the selection object as an argument and highlights it on the webpage.
The function signature looks something like this
function highlighter ( anchorNode, focusNode, commonAncestorContainer , focusOffset, anchorOffset)
I tried cloning the selection object and storing it, only to realize later that any changes made using the stored selection object wont obviously reflect back in the DOM
Is There a better way to do this (like storing path to the node?)