function getTextContentLength(node: Node): number {
  const textContent = node.textContent;
  return textContent === '\n' ? 0 : textContent.length;
}
Return the length of a node's textContent, regarding single newline
characters as zero-length. This allows us to avoid problems with identifying
the correct selection offset for empty blocks in IE, in which we
render newlines instead of break tags.