Merge two text nodes into one
357705
def textMerge(self, second):
        
        if second is None: second__o = None
        else: second__o = second._o
        ret = libxml2mod.xmlTextMerge(self._o, second__o)
        if ret is None:raise treeError('xmlTextMerge() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
1205817
function mergeAffixEmoticon(child, index, parent) {
  var children = child.children
  var position
  var node
  var prev

  if (children && children.length !== 0 && index !== 0) {
    position = -1

    while (children[++position]) {
      node = children[position]

      if (node.type === EMOTICON_NODE) {
        prev = parent.children[index - 1]

        prev.children = prev.children.concat(children.slice(0, position + 1))
        child.children = children.slice(position + 1)

        if (node.position && child.position && prev.position) {
          prev.position.end = node.position.end
          child.position.start = node.position.end
        }

        /* Next, iterate over the node again. */
        return index
      }

      if (node.type !== 'WhiteSpaceNode') {
        break
      }
    }
  }
}
1367675
function nodeText (node) {
  return squashWhitespace(node.textContent)

  function squashWhitespace (string) {
    return string.replace(/\s{2,}/g, ' ').trim()
  }
}
1042776
function fixParagraphNode(node, fullText) {
    const firstNode = node.children[0];
    const lastNode = node.children[node.children.length - 1];
    node.range = [firstNode.range[0], lastNode.range[1]];
    node.raw = fullText.slice(node.range[0], node.range[1]);
    node.loc = {
        start: {
            line: firstNode.loc.start.line,
            column: firstNode.loc.start.column
        },
        end: {
            line: lastNode.loc.end.line,
            column: lastNode.loc.end.column
        }
    };
}
1326060
private void mergeSymbol(Symbol from, Symbol to) {
    for (Node nodeToMove : from.references.keySet()) {
      if (!nodeToMove.equals(from.getDeclarationNode())) {
        to.defineReferenceAt(nodeToMove);
      }
    }
    removeSymbol(from);
  }
673319
function merge(target, source) {
                target.additionalNodes = target.additionalNodes || [];
                target.additionalNodes.push(source.node);
                if (source.additionalNodes) {
                    (_a = target.additionalNodes).push.apply(_a, source.additionalNodes);
                }
                target.children = ts.concatenate(target.children, source.children);
                if (target.children) {
                    mergeChildren(target.children);
                    sortChildren(target.children);
                }
                var _a;
            }
1262205
function mergeable(node) {
  var start
  var end

  if (node.type !== 'text' || !node.position) {
    return true
  }

  start = node.position.start
  end = node.position.end

  // Only merge nodes which occupy the same size as their `value`.
  return (
    start.line !== end.line || end.column - start.column === node.value.length
  )
}
964066
function mergeChildren( from, into, refNode, forward ) {
		var child, itemDir;
		while ( ( child = from[ forward ? 'getLast' : 'getFirst' ]( elementType ) ) ) {
			if ( ( itemDir = child.getDirection( 1 ) ) !== into.getDirection( 1 ) )
				child.setAttribute( 'dir', itemDir );

			child.remove();

			refNode ? child[ forward ? 'insertBefore' : 'insertAfter' ]( refNode ) : into.append( child, forward );
		}
	}
425325
function replaceNewlines (elem) {
  var node = elem.firstChild,
      depth = 0,
      br

  while (node) {
    if (node.nodeType === Node.ELEMENT_NODE) {

      if (node.firstChild) {
        depth += 1
        node = node.firstChild
      }
      else node = node.nextSibling

      continue
    }

    if (/\n/.test(node.data)) {
      node.splitText(node.data.indexOf('\n') + 1)

      br = node.splitText(node.data.length - 1)

      // We now have a lone text with \n as data.
      // Replace it with a <br>
      br.parentNode.replaceChild(document.createElement('br'), br)

      node = node.nextSibling
    }

    while (!node.nextSibling) {
      if (!depth) break

      depth -= 1
      node = node.parentNode
    }

    node = node.nextSibling
  }
}
665801
function(parent, text)
	{
		var doc = parent.ownerDocument;
		var node = doc.createTextNode(text);
		
		if (parent != null)
		{
			parent.appendChild(node);
		}
		
		return node;
	}
374794
def patch_text(actions, tree):
    """"""
    tree = etree.fromstring(tree)
    actions = patch.DiffParser().parse(actions)
    tree = patch_tree(actions, tree)
    return etree.tounicode(tree)
1195745
function splitTag(editor, node, cursor) {
	const open = getText(editor, node.open);
	const m = open.match(/(\s*\/)?>$/);
	const start = node.open.end.translate([0, m ? -m[0].length : 0]);
	editor.setTextInBufferRange(new Range(start, node.open.end), `></${node.name}>`);

	if (cursor) {
		cursor.setBufferPosition(start.translate([0, 1]));
	}
}
1023304
public static String getMergedNestedText(Node n) {
        StringBuilder sb = new StringBuilder();
        for (Node child : new IterableNodeList(n.getChildNodes())) {
            if (child instanceof Text || child instanceof CDATASection) {
                String s = child.getNodeValue();
                if (s != null) {
                    sb.append(s);
                }
            }
        }
        return sb.toString();
    }
586279
function split(nodes) {
    var section = [];

    var sections = _.reduce(nodes, function(sections, el) {
        if(el.type === 'hr') {
            sections.push(section);
            section = [];
        } else {
            section.push(el);
        }

        return sections;
    }, [])
     // Add remaining nodes
    .concat([section])
    // Exclude empty sections
    .filter(_.negate(_.isEmpty));

    // Copy over links (kramed needs them)
    sections.links = nodes.links || {};

    return sections;
}
1033024
def tree_text(node):
    
    text = []
    for descendant in walk_dom(node):
        if is_text(descendant):
            text.append(descendant.nodeValue)
    return ' '.join(text)
106955
function updateNode(node, content, append) {
  append = append || false;

  while(!append && node.firstChild) {
    node.removeChild(node.firstChild);
  }

  if(content instanceof Element) {
    node.appendChild(content);
  }
  else if(content instanceof Array) {
    content.forEach(function(element) {
      node.appendChild(element);
    });
  }
  else {
    node.textContent = content;
  }
}
1081437
function processTextNode(node, options) {
    options = options || {};

    var data = [].concat(getBasicFields(node, options)).
        concat([
            node.lineCount
        ]);

    if (!options.body) {
        data = data.concat(getExtensionFields(node, options));
    }

    data.node = node;
    return data;
}