Issue Details (XML | Word | Printable)

Key: XWIKI-3094
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Asiri Rathnayake
Reporter: Asiri Rathnayake
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XWiki Core

Erroneous rendering of xhtml content with <br/>[newline]<p> sequence

Created: 11/Jan/09 09:36   Updated: 12/Jan/09 09:52
Component/s: Rendering 2.0
Affects Version/s: 1.7
Fix Version/s: None

keywords: rendering,newline
Date of First Response: 11/Jan/09 12:15
Resolution Date: 12/Jan/09 09:45


 Description  « Hide
Consider the following test case which runs without any issues:
.#-----------------------------------------------------
.input|xhtml/1.0
.#-----------------------------------------------------
<html><br/><p>HelloWorld</p></html>
.#-----------------------------------------------------
.expect|event/1.0
.#-----------------------------------------------------
beginDocument
beginParagraph
onNewLine
onWord [HelloWorld]
endParagraph
endDocument
.#-----------------------------------------------------
.expect|xwiki/2.0
.#-----------------------------------------------------

HelloWorld

Now consider the following test case:

.#-----------------------------------------------------
.input|xhtml/1.0
.#-----------------------------------------------------
<html><br/>
<p>HelloWorld</p></html>
.#-----------------------------------------------------
.expect|event/1.0
.#-----------------------------------------------------
beginDocument
beginParagraph
onNewLine
onWord [HelloWorld]
endParagraph
endDocument
.#-----------------------------------------------------
.expect|xwiki/2.0
.#-----------------------------------------------------

HelloWorld

Note the newline between the <br/> element and the next paragraph. This test case fails;

The generated actual sequence of events is:

beginDocument
beginParagraph
onNewLine
onSpace
onWord [HelloWorld]
endParagraph
endDocument

And the resulting xwiki content:

 HelloWorld

1. IMO the newline should come before the paragraph element (not inside it).
2. The extra space should not be there.



 All   Comments   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Vincent Massol added a comment - 11/Jan/09 12:15
The extra space is a bug indeed. For the BR the problem is that the input is not valid XHTML so the pb is with the input IMO (with the cleaner).

Vincent Massol added a comment - 11/Jan/09 16:02
ok I've debugged the problem and the problem is that the XHTML parser receives invalid XHTML (BR is not a block element). Thus the clean must transform BR into DIV with the proper class.

Vincent Massol added a comment - 12/Jan/09 09:45
Duplicate of XWIKI-3101