Open
Bug 1417535
Opened 7 years ago
Updated 2 years ago
getSelection() returns wrong anchorNode/anchorOffset when selection contains nested different contenteditable context
Categories
(Core :: DOM: Selection, defect, P3)
Tracking
()
UNCONFIRMED
People
(Reporter: varoot, Unassigned)
References
Details
Attachments
(1 file)
7.92 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0 Build ID: 20171103003834 Steps to reproduce: This happens when contenteditable=true is nested inside contenteditable=false inside another contenteditable=true 1. See this fiddle https://jsfiddle.net/varoot/gt0xm5mn/ 2. Make a text selection over contenteditable part (-><-). For example from the word "selection" to "space" Actual results: anchorOffset is 0 anchorNode is (text) "<- space and look at values below." This is not the correct node and offset Expected results: (From Chrome and Edge) anchorOffset is 21 anchorNode is (text) "Try moving your selection over this ->"
Updated•7 years ago
|
Component: Untriaged → DOM
Product: Firefox → Core
Updated•7 years ago
|
Component: DOM → Selection
Updated•7 years ago
|
Priority: -- → P3
Comment 1•5 years ago
|
||
Guys,
This is happening because the way that range and selection in Chrome and Edge is different. (As a side, soon Edge will use the Chromium engine.)
Both Chrome and Safari change the selection in the selection object and the range in the range object to what they determine is the visible area. This change was made a few years ago when they shared a common webkit codebase.
I would suggest that in the interest of promoting standard behaviour between browsers that we follow their lead. Having written more than a few html editors in my day, I can tell you that it would result in better quality and less code.
Cheers,
Alex
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•