Bug 230594 - Invalid browser selection after splitting a text node
Summary: Invalid browser selection after splitting a text node
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 14
Hardware: Mac (Intel) macOS 10.15
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 249528
  Show dependency treegraph
 
Reported: 2021-09-21 21:14 PDT by James Toohey
Modified: 2022-12-17 02:12 PST (History)
6 users (show)

See Also:


Attachments
Replication HTML file (785 bytes, text/html)
2021-09-21 21:14 PDT, James Toohey
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Toohey 2021-09-21 21:14:28 PDT
Created attachment 438917 [details]
Replication HTML file

Hi team,

As per the spec, when splitting a text node, any live ranges that start or end in the node being split must have their respective nodes and offsets modified. 

https://dom.spec.whatwg.org/#concept-text-split (Important: Section 7)

In Safari 14 (and also in the newly released Safari 15 & Tech Preview), splitting a text node does not correctly adjust the selection to account for this:
- The offsets are not adjusted
- The nodes are not changed when appropriate

Please see the attached HTML file for a replication case. This works correctly in Firefox 92 and Chrome 93.
Comment 1 Sam Sneddon [:gsnedders] 2021-09-28 09:43:05 PDT
I kinda suspect this might be fixed by bug 220514 (live ranges in selection)? Though at least currently it appears regressed by live ranges in selection (even the initial selection is wrong).

Marking this is blocking, then others can debate whether that's fair. ;P
Comment 2 Radar WebKit Bug Importer 2021-09-28 21:15:14 PDT
<rdar://problem/83655114>
Comment 3 Ryosuke Niwa 2022-12-17 02:11:30 PST
Enabling live range selection doesn't fix this bug.