Range stuck when splitText() on line break
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: ncts, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:120.0) Gecko/20100101 Firefox/120.0
Steps to reproduce:
I was trying to get rendered lines of text, by iterating over the text and checking if text in a Range
span on more than one line with range.getClientRects()
, then splitText()
each line into its own Text
.
Actual results:
After the first splitText()
on the line break, the Range
was stuck on the "edge" and enters infinite loop. Chrome and Safari proceeded normally.
An example is at https://codepen.io/pen/dyaRXMJ. Open the web console and click the upper right "Step" button to see step by step output. There are dotted boxes around rects of last processed "line".
One anomaly I noticed is that the Range has an "empty" text node as its startContainer
, but hovering on that node points to the parent element.
Expected results:
It should go to the next and later lines.
Updated•2 years ago
|
Description
•