Selecting an entire text node yields a range with the parent node being the endContainer

Confirmed Issue #15996689 • Assigned to Amit J.

Details

Author
Alexander E.
Created
Feb 17, 2018
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
16.16299
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Disclaimer

I’m not exactly sure, if this is really a bug, because when reading the specs I just gave up and came to the conclusions, that RFCs aren’t intended to be read by humans. Joke aside, Edge behaves significantly different when compared to other browsers (including but not limited to Internet Explorer 11) here, up until a point where its behavior both makes only little sense and is somewhat unexpected.

Instructions

Selecting the entire contents of a text node inside a contenteditable-area yields a selection range start starts at the text node (startOffset === 0), but ends in the containing parent node.

<p>Test</p>

Select the word Test by either clicking marking the entire word with the mouse or double click it, in both ways the entire word will be selected. In Edge, the range will end with the endContainer being the <p> and endOffset === 1 which equals "after the text node".

Demo

https://jsfiddle.net/dtdesign2/gybfc6kv/13/

Other Browsers

The selection range contains only the text node, starting with startOffset === 0 to endOffset === endContainer.textContent.length. This has been verified in:

  • Internet Explorer 11
  • Chrome 65 Beta
  • Firefox 58

Edge is so far the only browser that yields this kind of range, other browsers have not been tested by me.

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “James M.”

      Changed Assigned To to “Grisha L.”

      Changed Status to “Confirmed”

      Changed Assigned To from “Grisha L.” to “Amit J.”

    You need to sign in to your Microsoft account to add a comment.

    Sign in