Open Bug 1360238 Opened 8 years ago Updated 2 years ago

window.getSelection().toString() displays extra "\n" characters on multiple block elements, even if they are display:inline

Categories

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

53 Branch
defect

Tracking

()

Webcompat Priority P3
Tracking Status
firefox68 --- affected

People

(Reporter: stylizit, Unassigned)

References

()

Details

(Whiteboard: [webcompat][needs-wpt-?])

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 Steps to reproduce: 1) Open the url : data:text/html;charset=utf-8,<div style%3D"display%3Ainline%3B">this is<%2Fdiv><div style%3D"display%3Ainline%3B">on the same line<%2Fdiv> 2) Right-click on the text in the page and click "Select all" 3) Open Devtools and go to the Console tab 4) Run window.getSelection().toString() Actual results: Output returned: "this is on the same line" Expected results: Output should be: "this ison the same line"
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Note that Firefox doesn't add an extra "\n" character for the below url data:text/html;charset=utf-8,<span style%3D"display%3Ainline%3B">this is<%2Fspan><span style%3D"display%3Ainline%3B">on the same line<%2Fspan> so this seems to happen (presumably) only on block elements. Safari 10.0.3 & Chrome 57.0.2987.133 both display the selected text correctly (without the extra "\n" character).
Priority: -- → P3

This could be one of the reasons quote-reply behaves differently in Firefox than Chrome on GitHub. Not 100% sure.
https://webcompat.com/issues/28521

Flags: webcompat?
Whiteboard: [webcompat]

Migrating Webcompat whiteboard priorities to project flags. See bug 1547409.

Webcompat Priority: --- → ?

See bug 1547409. Migrating whiteboard priority tags to program flags.

Webcompat Priority: ? → revisit
Whiteboard: [webcompat] → [webcompat][needs-wpt-?]
Component: DOM: Core & HTML → Serializers

The bug has a release status flag that shows some version of Firefox is affected, thus it will be considered confirmed.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Webcompat Priority: revisit → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.