dillon1000/react
Commit
Browse files Rewrite ReactDOMSelection to use fewer ranges (#9992)
We heard from Chrome engineers that creating too many Range objects slows down Chrome because it needs to keep track of all of them for the case that anchor/focus nodes get removed from the document. We can just implement this calculation without ranges anyway. jsdom doesn't support Range objects, but I copied the fuzz test code into my browser and manually compared it against our old implementation https://gist.github.com/sophiebits/2e6d571f4f10f33b62ea138a6e9c265c; with 200,000 trials no differences were found.
Changed paths2 files
First-parent comparisonsrc/renderers/dom/shared/ReactDOMSelection.js ModifiedA src/renderers/dom/shared/__tests__/ReactDOMSelection-test.js AddedPatch
Files changed
Rendering syntax-highlighted changes…