Version: 3.1.2 (using KDE KDE 3.1.2) Installed from: Debian testing/unstable Packages Compiler: gcc (GCC) 3.3 (Debian) OS: Linux The following code produces either too much vertical spacing above each <p> or too little after each </p> ... I am not sure which is more correct. <ul> <li> <p>this is paragraph 1, it contains a list <ul> <li>bulet one <li>bulet two </ul> </P> <li><p>this is paragraph 2, it contains no list</p> </ul> Basically, I would expect that there would be as much space above the nested list as there would be below it.
I can reproduce this bug with KDE 3.3.2a and have narrowed it a little bit down: At first one remark. I think the above example code has IMHO a wrong tag nesting. The <p> should be ahead the <li> as the whole list element seems to be meant as a paragraph in the above example. So the code would look correctly (and additional with closing tags) like this: <ul> <p> <li>this is paragraph 1, it contains a list <ul> <li>bullet one</li> <li>bullet two</li> </ul> </li> </p> <p><li>this is paragraph 2, it contains no list</li></p> </ul> Konqueror renders this example with nice looking spacing and makes no strange positioning as with the first example. Now some analysis about positioning of the single elements: <p></p> is separated by plain text (and other elements) that is ahead and after the begin and closing tag with a blank line. A code example that shows this in konqueror: this is plain text <p>this is a paragraph</p> this is also plain text But if paragraphs are within a list konqueror dosen't make the first blank line. Here is the code example (the parapgraph is only in a new line after the "this is a list" text): <li>this is a list <p>this is a paragraph within a list</p> </li> I suppose the case why this spacing is removed deliberately is the following example (which would look strange otherwise): <li> <p>this is a paragraph within a list</p> </li> At the moment Konqueror shows the paragraph text directly after the list dot, what makes sense. If the first blank line would be added there would be a lonesome list dot a blank line and then a paragraph (by the way Mozilla 1.4.3 exactly shows this ugly behaviour and only get it nice as in Konqueror if you make a <ul></ul> around the list). So a good solution to the problem that takes both cases into account (one time the paragraph is directly after the list opening tag and one time after some plain text with a list) would be: 1) opening tags: a) If the <p> tag is directly after the <li> tag (<li><p>) don't remove the blank line but put it ahead the <li> tag (and if there is then a collision of two blank lines collapse them into one). b) If the <p> tag is after some text regadless in which environement as a list item make everything as normal and make normal spacing with a blank line ahead the <p>. 2) closing tags: a) Independently (!) from the opening tags do the same with the closing tags. If the </p> is directly ahead the </li> tag (</p></li>) put the blank line after the </li> tag (and if there is then a collision of two blank lines collapse them into one). b)If after the </p> tag is some text regadless in which environement as a list item make everything as normal and make normal spacing with a blank line after the </p>. With this idea the code of the first example would render as in the proper second example. And the actual list-paragraph workaround of Konqueror has no negative side effects.
As I supposed it this bug is due to the solution of another bug that occoured on the follwoing example: <li> <p>this is a paragraph within a list</p> </li> This fixed bug can be found at Bug 21656 So the solution of this bug needs to changed in a way similar as I proposed above.
The difference to firefox in this case is just that firefox parses the </p> as a new <P> tag. So in firefox: <ul> <li> <p>this is paragraph 1, it contains a list <ul> <li>bulet one <li>bulet two </ul> </P> <li><p>this is paragraph 2, it contains no list</p> </ul> becomes: <ul> <li> <p>this is paragraph 1, it contains a list </p> <ul> <li>bulet one <li>bulet two </ul> <p></p> <li><p>this is paragraph 2, it contains no list</p> </ul> I am not sure we should copy that behavior..
The testcase in the second comment is not valid, so it shouldn't be considered. Anyway firefox 3.5 and konqueror 4.4 renders the testcase in the same correct way.