Open Bug 1586033 Opened 1 year ago Updated 1 year ago

contenteditable: range startOffset and endOffset have incorrect values after paste


(Core :: DOM: Selection, defect, P3)

71 Branch





(Reporter: peterkwebb, Unassigned)



(1 file)

Attached file Contenteditable1.html

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0

Steps to reproduce:

  1. Open attached file 'Contenteditable1.html' in Firefox Nightly (71.0a1).
  2. Within the outlined contenteditable paragraph, place caret in the text in various places and select parts of the text to confirm that startOffset and endOffset are giving expected values.
  3. Select text "CD" and use cut-and-paste (or drag) to insert after "AB" (so text becomes alphabetical).
  4. Place the caret before each of the characters ABCDEFGH and after the 'H', noting the values of startOffset and endOffset.
  5. Select 'BCDE' in text (for example) and note values of startOffset and endOffset.

Note Chrome, Edge and IE have same, or similar, behaviour.

Actual results:

Observed values for startOffset and endOffset: 0 1 0 1 0 1 2 3 4.

With 'BCDE' selected observed startOffset=1 and endOffset=1 (implying caret in text with no text selected).

Expected results:

Expected values for startOffset and endOffset: 0 1 2 3 4 5 6 7 8.

With 'BCDE' selected expect startOffset=1 and endOffset=5 (implying 4 characters selected).

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Editor
Product: Firefox → Core
Component: Editor → Selection
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.