I have a set of ranges, created from the tokensToRanges
function in:
Convert tokens into selection ranges
Now I want to loop over each range, and apply an action to them. However I get an error:
Uncaught Error: Range error: Range is no longer valid after DOM mutation ([WrappedRange("foobar":6)])
Now I understand why I am getting the error, but I am wondering how can I loop over a set of ranges, and manipulate each one?
It's a tricky problem that I've run up against several time. Your options are basically: