Bug 263306 - DOMSelection toString doesn't work with flex-direction:row
Summary: DOMSelection toString doesn't work with flex-direction:row
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: Safari 17
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-17 23:48 PDT by Morgan Redding
Modified: 2023-10-18 14:58 PDT (History)
5 users (show)

See Also:


Attachments
test (344 bytes, text/html)
2023-10-18 14:52 PDT, Ryosuke Niwa
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Morgan Redding 2023-10-17 23:48:16 PDT
When an element with "display:flex; flex-direction:row" is selected, selection.toString() inserts newlines between the child elements.

Bug is on both Desktop and iOS Safari

Safari Version: Version 17.0 (18616.1.27.111.22, 18616)

Bug is not present in Chrome

Repro steps:

```
myDiv.innerHTML = `<div style="display:flex; flex-direction:row;"><div>a</div><div>b</div></div>`;
r = document.createRange();
r.setStartBefore(myDiv);
r.setEndAfter(myDiv);
sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(r);
sel.toString()
```

Expected: "ab"

Actual: "
a
b
"
Comment 1 Ryosuke Niwa 2023-10-18 14:52:04 PDT
Created attachment 468266 [details]
test

As far as I've tested, Chrome 118.0.5993.70 as well as Firefox 118.0.2 both serializes this as "a\nb" with new line in between "a" and "b".