Closed Bug 2043329 Opened 21 days ago Closed 7 days ago

Text Fragments: Treat `<br>` as block boundary

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

RESOLVED FIXED
153 Branch
Tracking Status
firefox153 --- fixed

People

(Reporter: jjaschke, Assigned: jjaschke)

Details

Attachments

(2 files)

Attached file minimal-testcase

Case 1: open the attached file, select the second "test", and hit "Copy Link to Highlight" in the context menu.

Expected Results: :~:text=test-,test
Actual Results: :~:text=testtest

Case 2: open the attached file, select both "test", hit "Copy Link to Highlight" in the context menu.
Expected Results: :~:text=test,test
Actual Results: :~:text=test%20test

Note that there is no whitespace between the first and second test, only a <br> element. The <br> is ignored, and the algorithm doesn't see a word boundary, and therefore treats these two words as one. If there is whitespace added (data:text/html,test<br> test), case 1 works, case 2 is still broken.

I believe the right way of fixing this is to treat <br> as a block boundary, which both allows the text before the <br> to be used as prefix, and which enforces range-based matching if the target range spans across a <br>.

Attachment #9591109 - Attachment filename: file_2043329.txt → testcase.html

Treat <br> as block-level in NodeHasBlockLevelDisplay so that text across
<br> is not concatenated.
Without this, the text directive for

foo<br>bar

would be :~:text=foobar, not :~:text=foo,bar.

Pushed by jjaschke@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/3db4104a5f08 https://hg.mozilla.org/integration/autoland/rev/8e75d94753cb Text Fragments: Treat <br> as a block boundary for text directives. r=dom-core-reviewers,smaug
Status: ASSIGNED → RESOLVED
Closed: 7 days ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: