1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-17 20:51:20 +02:00

Fix IE11 error (#1264)

* Fix IE11 error

* Update find-dom-point.js
This commit is contained in:
Ivan Starkov
2017-10-26 04:09:02 +03:00
committed by Ian Storm Taylor
parent ed593c732b
commit cd0e577023

View File

@@ -15,10 +15,18 @@ import findDOMNode from './find-dom-node'
function findDOMPoint(key, offset) {
const el = findDOMNode(key)
const window = getWindow(el)
const iterator = window.document.createNodeIterator(el, NodeFilter.SHOW_TEXT)
let start = 0
let n
// COMPAT: In IE, this method's arguments are not optional, so we have to
// pass in all four even though the last two are defaults. (2017/10/25)
const iterator = window.document.createNodeIterator(
el,
NodeFilter.SHOW_TEXT,
() => NodeFilter.FILTER_ACCEPT,
false
)
while (n = iterator.nextNode()) {
const { length } = n.textContent
const end = start + length