Skip to content

Commit c947b06

Browse files
Merge pull request #57 from blimmer/fix-issue-56
fix(utils): use native removeAllRanges() to fix WebKit NotFoundError
2 parents 038fe90 + 1dbc1cc commit c947b06

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

packages/utils/src/dom.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
export const removeAllSelection = () => {
2-
const selection = window.getSelection();
3-
for (let i = 0; i < selection.rangeCount; i++) {
4-
selection.removeRange(selection.getRangeAt(i));
5-
}
2+
window.getSelection()?.removeAllRanges();
63
};
74

85
export const syncScroll = (left: HTMLElement, right: HTMLElement) => {

0 commit comments

Comments
 (0)