Closed Bug 409262 Opened 17 years ago Closed 16 years ago

extra linebreak with { white-space: pre }

Categories

(Core :: DOM: HTML Parser, defect)

1.8 Branch
x86
OpenBSD
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 550550

People

(Reporter: mszudzik, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.8.1.6) Gecko/20070819 Firefox/2.0.0.6 Build Identifier: Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.8.1.6) Gecko/20070819 Firefox/2.0.0.6 According to the HTML 4.01 Specification http://www.w3.org/TR/html401/appendix/notes.html#notes-line-breaks "a line break immediately following a start tag must be ignored" and "this applies to all HTML elements without exception". But when an inline-level element is given the CSS properties { display: block; white-space: pre }, the linebreak immediately following the start tag is not ignored. Reproducible: Always Steps to Reproduce: Consider the following html document <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/HTML4.01/strict.dtd"> <html><head><style type="text/css"> span { display: block; white-space: pre } </style></head><body> <p>first line <span> second line </span> third line</p> </body></html> Actual Results: The actual results are first line second line third line Expected Results: The expected results are first line second line third line
Attached file Example of bug
This bug appears to be unrelated to the { display: block } property. It occurs when ANY block-level element EXCEPT <pre> is given then { white-space: pre } property. For example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/HTML4.01/strict.dtd"> <html><head><style type="text/css"> div { white-space: pre } </style></head><body> <p>first line</p> <div> second line </div> <p>third line</p> </body></html>
Summary: extra linebreak when { display: block } is combined with { white-space: pre } → extra linebreak when block-level element has { white-space: pre }
Actually, this bug affects ANY ELEMENT that has { white-space: pre } except for <pre>. It is not specific to block-level elements. Given what the HTML 4.01 Specification says about linebreaks, the following two documents should be rendered the same. Unfortunately, they aren't. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/HTML4.01/strict.dtd"> <html><head><style type="text/css"> span { white-space: pre } </style></head><body> <p>This <span> should be </span> all on one line.</p> </body></html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/HTML4.01/strict.dtd"> <html><head><style type="text/css"> span { white-space: pre } </style></head><body> <p>This <span>should be</span> all on one line.</p> </body></html>
Summary: extra linebreak when block-level element has { white-space: pre } → extra linebreak with { white-space: pre }
Component: General → Style System (CSS)
Product: Firefox → Core
QA Contact: general → style-system
Version: unspecified → 1.8 Branch
Parsing that way is actually not compatible with web content. HTML5 is going to specify parsing that is. In any case, this is not a style system issue.
Component: Style System (CSS) → HTML: Parser
QA Contact: style-system → parser
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → WONTFIX
Forward-duping to bug with a slightly better explanation (and more appropriate resolution).
Resolution: WONTFIX → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: