Open Bug 1638969 Opened 4 years ago Updated 4 years ago

Select All, Ctrl+A - does not select content of the visible <head>

Categories

(Core :: DOM: Selection, defect)

77 Branch
defect

Tracking

()

Tracking Status
firefox77 --- affected

People

(Reporter: sergeykish, Unassigned)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0

Steps to reproduce:

I've displayed <head>, <title>, <script> and <style> with CSS

head, title,script, style { display: block }

Ctrl+A or Edit / Select All

Actual results:

it selects <body> content

Expected results:

It should select all visible text content (including <head>)

For reference, this is the problematic check. However that's not enough, and that selection can't be copied, so needs more digging.

We should probably remove most of these assumptions of "<body> is the root in html documents".

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
See Also: → editing-outside-body

anchorNode and focusNode not text but <body>

getSelection()
Selection { anchorNode: body, anchorOffset: 0, focusNode: body, focusOffset: 6, isCollapsed: false, rangeCount: 1, type: "Range", caretBidiLevel: 0 }
getSelection().toString() is body content

In contrast Chrome selects all but

getSelection()
Selection { anchorNode: text, anchorOffset: 0, baseNode: text, baseOffset: 0, extentNode: body, extentOffset: 0, focusNode: body, focusOffset: 0, isCollapsed: false, rangeCount: 1, type: "Range" }

focusNode is <body> and

getSelection().toString()
"Select All in <head>, <title>, <script> <style>
//foo
/* foo */
"

does not include <body>

Firefox 77 selects all text

getSelection()
Selection { anchorNode: html, anchorOffset: 0, focusNode: html, focusOffset: 2, isCollapsed: false, rangeCount: 1, type: "Range", caretBidiLevel: null }

Looks right, but

getSelection().toString()
"<html contenteditable> Select All



Ctrl + A or Edit > Select All"

No <head> content and I don't know where it got newlines.

Oh, it does not matter if <head> is visible

But for same html-contenteditable-select-all-test.htm

getSelection().getRangeAt(0).toString()
"<html contenteditable> Select Allhead, title, style, script { display: block }//foo<html contenteditable> Select AllCtrl + A or Edit > Select All"

different

The first one.

It really is broken

getSelection().selectAllChildren(document.documentElement)
getSelection().toString()
"<html contenteditable> Select All



Ctrl + A or Edit > Select All"

That is a blocker

Severity: -- → S3
Component: DOM: Core & HTML → DOM: Selection
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: