(*** This bug was imported into bugs.kde.org ***) Package: khtml Version: 4.0 (using KDE 3.0.3 ) Severity: normal Installed from: Unofficial RedHat Compiler: gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-112) OS: Linux (i586) release 2.4.18-10 OS/Compiler notes: A line break _immediately_ after a PRE tag should be ignored instead of being rendered as a blank line. The HTML 4.01 spec section B.3.1 http://www.w3.org/TR/html401/appendix/notes.html#notes-line-breaks says "SGML (see [ISO8879] section 7.6.1) specifies that a line break immediately following a start tag must be ignored as must a line break immediately before an end tag. This applies to all HTML elements without exception." Konqueror from KDE 3.0.3 3.0.0 and 3.0.1 don't ignore the line break and render a blank line above the content of the PRE element. Here's a sample HTML file. Galeon 1.2.0 and Mozilla 0.9.9 render this correctly (the white spaces above the two PRE elements have the same height). -------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <body> <p>The spacing above and below</p> <pre>this one line PRE element</pre> <p>should be exactly the same as the spacing above and below</p> <pre> this multiline PRE element </pre> <p>because whitespace before start tags should be ignored.</p> </body> </html (Submitted via bugs.kde.org) (Called from KBugReport dialog)
I disagree: 1. khtml renders just like Mozilla does, 2. in XML (and I that's what HTML is becoming more and more) you cannot just ignore whitespace. On the other hand, we ignore the whitespace just after <li>, too, I think...
Naturally, I disagree with comment #1. 1. When I view the HTML sample given above in Konqueror and in Mozilla 0.9.9, they do not render it the same way. In Mozilla, the white spaces above the two PRE elements have the same height. In Konqueror, the white space above the second PRE element is taller. You can make this more obvious by adding a STYLE element containing "PRE { background-color: red; }" to the example: Mozilla renders each PRE as a line of text on a red background, while Konqueror displays the second as a line of text on a red background and with a blank red line above it. 2a. What HTML (and XHTML) may become is not the issue. When a document's DOCTYPE says that it is HTML 4.01, KHTML must render it according to the HTML 4.01 specification. 2b. XML strictly avoids everything to do with the appearance of displayed documents. The XML spec deals with the structure of the document, and leaves rendering issues to what it calls the "application". The "White Space Handling" section of the XML spec says that the XML processor must pass white space characters through to the application, but it doesn't say that the application must display them on screen.
read the HTML spec as "ignore for display" and be happy ;) ..at least this IS a bug (in Mozilla as in konq).
*** Bug 65546 has been marked as a duplicate of this bug. ***
Created attachment 5244 [details] Line break render as space prior to </a> I see this a fair bit, ironically it usually involves a validation image... typically, something like the following code is used (which is what is in my test case): <a href="http://validator.w3.org/check/referer"> <img src="http://www.w3.org/Icons/valid-html401" alt="ValidHTML4.01!" title="ValidHTML4.01!" height="31" width="88"> </a> KHTML displays an underlined linked space following the image. I recommend that the summary be altered to "Line break immediately before and after tags should be ignored". As a web site creator, one can get around this by pasting exactly what the W3C provides upon validation: <a href="http://validator.w3.org/check/referer"><img src="http://www.w3.org/Icons/valid-html401" alt="ValidHTML4.01!" title="ValidHTML4.01!" height="31" width="88"></a> But both are legit and the specs say both should be rendered the same way. I have to confess that I believe the specs are a little inconsistent here and that KHTML is more consistent, but nevertheless those are the specs and that's how Gecko and Opera do it (don't know about IE).
Konqueror 3.2.2, from KDE 3.2.2 (contributed RPMs for SuSE 9.0) displays my example the way I think it should.
... but see bug 81393.