Empty text nodes with white-space:pre use line-height space rather than no space
Categories
(Core :: Layout: Block and Inline, defect)
Tracking
()
People
(Reporter: pfg, Unassigned)
Details
Attachments
(1 file)
350 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:90.0) Gecko/20100101 Firefox/90.0
Steps to reproduce:
Create a div with white-space: pre or pre-wrap and add an empty text node to it. Or, run this script in an about:blank tab:
{
let sample = document.createElement("div");
sample.style.whiteSpace = "pre-wrap";
sample.style.backgroundColor = "red";
sample.appendChild(document.createTextNode(""));
document.body.appendChild(sample);
}
Actual results:
The div is visible and takes up space with the height equal to the line height even though it has no content
Expected results:
The div should not be visible or take up space since the text node is empty. Other browsers (Chrome, Safari) display it this way.
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 2•3 years ago
|
||
Thanks for the bug report! Here's an interactive testcase that demonstrates the bug.
STR: Load testcase, click button.
EXPECTED RESULTS: No red.
ACTUAL RESULTS: Red is visible. (The black-bordered box grows its height to be 1 line-height tall, showing its red background.)
Chromium, Safari, and EdgeHTML all produce EXPECTED RESULTS.
Firefox produces ACTUAL RESULTS.
Updated•3 years ago
|
Comment 3•3 years ago
|
||
Looks like this is already tracked in bug 1680706.
Description
•