Skip to content

Commit f7a538c

Browse files
awearygaearon
authored andcommitted
Remove getTextContentAccessor (facebook#13434)
According to caniuse the only browsers that don't support textContent are <=IE8, which we no longer support.
1 parent d1c42d2 commit f7a538c

3 files changed

Lines changed: 2 additions & 33 deletions

File tree

packages/react-dom/src/client/ReactDOMSelection.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
import getNodeForCharacterOffset from './getNodeForCharacterOffset';
9-
import getTextContentAccessor from './getTextContentAccessor';
109
import {TEXT_NODE} from '../shared/HTMLNodeType';
1110

1211
/**
@@ -155,7 +154,7 @@ export function setOffsets(node, offsets) {
155154
const doc = node.ownerDocument || document;
156155
const win = doc ? doc.defaultView : window;
157156
const selection = win.getSelection();
158-
const length = node[getTextContentAccessor()].length;
157+
const length = node.textContent.length;
159158
let start = Math.min(offsets.start, length);
160159
let end = offsets.end === undefined ? start : Math.min(offsets.end, length);
161160

packages/react-dom/src/client/getTextContentAccessor.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

packages/react-dom/src/events/FallbackCompositionState.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import getTextContentAccessor from '../client/getTextContentAccessor';
9-
108
/**
119
* These variables store information about text content of a target node,
1210
* allowing comparison of content before and after a given event.
@@ -69,5 +67,5 @@ export function getText() {
6967
if ('value' in root) {
7068
return root.value;
7169
}
72-
return root[getTextContentAccessor()];
70+
return root.textContent;
7371
}

0 commit comments

Comments
 (0)