Container.nodeType == Node.DOCUMENT_NODE
    ? range.startContainer
    : range.startContainer.ownerDocument;
  var frag = ownerDoc.createDocumentFragment();

  // "If the context object's start and end are the same, abort this method,
  // returning frag."
  if (range.startContainer == range.endContainer
  && range.startOffset == range.endOffset) {
    return frag;
  }

  // "Let original start node, original start offset, original end node, and
  // original end offset be the context object's start and en