i], range)) {
        firstPartiallyContainedChild = commonAncestor.childNodes[i];
        break;
      }
    }
    if (!firstPartiallyContainedChild) {
      throw "Spec bug: no first partially contained child!";
    }
  }

  // "If original end node is an ancestor container of original start node,
  // let last partially contained child be null."
  var lastPartiallyContainedChild;
  if (isAncestorContainer(originalEndNode, originalStartNode)) {
    lastPartiallyContainedChild = null;
  // "Otherwise, let 