Open Bug 1156286 Opened 9 years ago Updated 3 years ago

window.getSelection returns the wrong object in a contentEditable label

Categories

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

37 Branch
x86_64
Windows 7
defect

Tracking

()

UNCONFIRMED

People

(Reporter: kcred11, Unassigned)

References

()

Details

(Keywords: testcase)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36

Steps to reproduce:

Tried this both on v37 and nightly v40.0a1 (4/19).

1) see example @ https://jsfiddle.net/ktc8azf2/
2) open web console
3) click on the contenteditable label


Actual results:

When the label is empty:

1) The caret is not set to be inside the label.

2) The Selection object returned has both the anchorNode and focusNode set to the contenteditable label. Sometimes they will be the root HTML document or the BODY.


Expected results:

window.getSelection() should return the lowest selectable node under the cursor inside of the label, in this JSFiddle that is an empty Paragraph node, and also put the caret inside of that node.

This behaviour is different from other HTML5 browsers; tested in both Chrome v42.0.2311.90 and IE11.
Component: Untriaged → Selection
Keywords: testcase
Product: Firefox → Core

Bulk-downgrade of unassigned, >=5 years untouched DOM/Storage bugs' priority.

If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.