| @@ 101-122 (lines=22) @@ | ||
| 98 | data: data |
|
| 99 | }; |
|
| 100 | } |
|
| 101 | function getText(node) { |
|
| 102 | var txt; |
|
| 103 | if (node.nodeType === 3) { |
|
| 104 | return node.data; |
|
| 105 | } |
|
| 106 | if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) { |
|
| 107 | return ''; |
|
| 108 | } |
|
| 109 | if (isContentEditableFalse(node)) { |
|
| 110 | return '\n'; |
|
| 111 | } |
|
| 112 | txt = ''; |
|
| 113 | if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) { |
|
| 114 | txt += '\n'; |
|
| 115 | } |
|
| 116 | if (node = node.firstChild) { |
|
| 117 | do { |
|
| 118 | txt += getText(node); |
|
| 119 | } while (node = node.nextSibling); |
|
| 120 | } |
|
| 121 | return txt; |
|
| 122 | } |
|
| 123 | function stepThroughMatches(node, matches, replaceFn) { |
|
| 124 | var startNode, endNode, startNodeIndex, endNodeIndex, innerNodes = [], atIndex = 0, curNode = node, matchLocation, matchIndex = 0; |
|
| 125 | matches = matches.slice(0); |
|
| @@ 59-80 (lines=22) @@ | ||
| 56 | [m[0]] |
|
| 57 | ]; |
|
| 58 | } |
|
| 59 | function getText(node) { |
|
| 60 | var txt; |
|
| 61 | if (node.nodeType === 3) { |
|
| 62 | return node.data; |
|
| 63 | } |
|
| 64 | if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) { |
|
| 65 | return ''; |
|
| 66 | } |
|
| 67 | txt = ''; |
|
| 68 | if (isContentEditableFalse(node)) { |
|
| 69 | return '\n'; |
|
| 70 | } |
|
| 71 | if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) { |
|
| 72 | txt += '\n'; |
|
| 73 | } |
|
| 74 | if (node = node.firstChild) { |
|
| 75 | do { |
|
| 76 | txt += getText(node); |
|
| 77 | } while (node = node.nextSibling); |
|
| 78 | } |
|
| 79 | return txt; |
|
| 80 | } |
|
| 81 | function stepThroughMatches(node, matches, replaceFn) { |
|
| 82 | var startNode, endNode, startNodeIndex, endNodeIndex, innerNodes = [], atIndex = 0, curNode = node, matchLocation = matches.shift(), matchIndex = 0; |
|
| 83 | out: |
|