MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / findTextNode

Function findTextNode

lib/web/CodeMirror/test/contenteditable_test.js:7–17  ·  view source on GitHub ↗
(dom, text)

Source from the content-addressed store, hash-verified

5 var Pos = CodeMirror.Pos
6
7 function findTextNode(dom, text) {
8 if (dom instanceof CodeMirror) dom = dom.getInputField()
9 if (dom.nodeType == 1) {
10 for (var ch = dom.firstChild; ch; ch = ch.nextSibling) {
11 var found = findTextNode(ch, text)
12 if (found) return found
13 }
14 } else if (dom.nodeType == 3 && dom.nodeValue == text) {
15 return dom
16 }
17 }
18
19 function lineElt(node) {
20 for (;;) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected