code: function nodeContainsSel(node, selection) {
    var nodeRange = node.ownerDocument.createRange(),
        iLen = selection.rangeCount;
    nodeRange.selectNode(node);
    for (var i = 0; i < iLen; i++) {
      var selRange = selection.getRangeAt(i);
      if (selRange.compareBoundaryPoints(Range.START_TO_START, nodeRange) < 0 || selRange.compareBoundaryPoints(Range.END_TO_END, nodeRange) > 0) {
        return false;
      }
    }
    return true;
  }
docs: Indicates whether the selection is part of the node or not.
  @param {Node} node - Target node.
  @param {Selection} selection - The parsed selection.
  @returns {boolean} `true` if all ranges of `selection` are part of `node`.