| Summary: | innerText from element with "white-space: pre-line" incorrectly removes line breaks | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | ik | ||||
| Component: | DOM | Assignee: | Chris Dumez <cdumez> | ||||
| Status: | NEW --- | ||||||
| Severity: | Normal | CC: | ahmad.saleem792, cdumez, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | BrowserCompat, InRadar, WPTImpact | ||||
| Version: | Safari 15 | ||||||
| Hardware: | All | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
ik
2022-05-18 01:41:29 PDT
https://html.spec.whatwg.org/multipage/dom.html#rendered-text-collection-steps says: > If node is a Text node, then for each CSS text box produced by node, in content order, compute the text of the box after application of the CSS 'white-space' processing rules and 'text-transform' rules, set items to the list of the resulting strings, and return items. The CSS 'white-space' processing rules are slightly modified: collapsible spaces at the end of lines are always collapsed, but they are only removed if the line is the last line of the block, or it ends with a br element. Soft hyphens should be preserved. [CSSTEXT] This implies that pre-line should be preserve the new lines. Not looked closely at Firefox, but it seems Safari is the only browser failing the '\n preserved ("<div style='white-space:pre-line'>abc\ndef")' subtest at https://wpt.fyi/results/html/dom/elements/the-innertext-and-outertext-properties/getter.html?label=master&label=experimental&product=chrome&product=firefox&product=safari&aligned Pull request: https://github.com/WebKit/WebKit/pull/738 Any news on this? A pull request was filed but nothing since? |