ShadowRoot's getSelection().getRangeAt(0) returns incorrect Range object in Google Chrome 35
Seems like it is a bug reported by me here and confirmed by the chromium team at the end of the issue thread.
I've created a plunk which shows how we can save shadowRoot selection range and use it when needed.Problem is this.shadowRoot.getSelection().getRangeAt(0) returns incorrect range, you've to create range from this.shadowRoot.getSelection() by getSelection().setStart, getSelection().setEnd. For more understanding see the plunk
shadowRoot.getSelection.getRangeAt(0) instead use var selRange=document.createRange();var shadowRootSelection = this.shadowRoot.getSelection();selRange.setStart(shadowRootSelection.anchorNode, shadowRootSelection.anchorOffset); selRange.setEnd(shadowRootSelection.focusNode, shadowRootSelection.focusOffset);