exploding selection
For this experiment, I wanted to see if browsers retain your text selection if the selected text breaks apart spatially.
It turns out that they do! Try selecting some of this text to see.
This mostly works how I'd hoped it would, but there are some issues that I haven't resolved:
- Characters right before or right after the selection are sometimes included in the explosion. I think this has to do with the concept of "anchor nodes" and "target nodes" in browser selection.
- The performance is worse than I'd like, especially for large selections. It got a lot better when I moved the `selection.containsNode` call outside of the animation loop, but all of the CSS updates are still surprisingly slow.