diff --git a/lib/rangy-textrange.js b/lib/rangy-textrange.js index e0265d1c..2e71d355 100644 --- a/lib/rangy-textrange.js +++ b/lib/rangy-textrange.js @@ -1674,10 +1674,10 @@ var rangeBetween = this.cloneRange(); var startIndex, endIndex; if (rangeStartsBeforeNode) { - rangeBetween.setStartAndEnd(this.startContainer, this.startOffset, parent, nodeIndex); + rangeBetween.setStartAndEnd(this.startContainer, this.startOffset, containerNode, 0); startIndex = -rangeBetween.text(characterOptions).length; } else { - rangeBetween.setStartAndEnd(parent, nodeIndex, this.startContainer, this.startOffset); + rangeBetween.setStartAndEnd(containerNode, 0, this.startContainer, this.startOffset); startIndex = rangeBetween.text(characterOptions).length; } endIndex = startIndex + this.text(characterOptions).length;