Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#9167 closed Bug (fixed)

Switching to source and back creates invalid html

Reported by: Larry Hinderks Owned by:
Priority: Normal Milestone: CKEditor 3.6.6
Component: General Version: 3.6.4
Keywords: Oracle Cc:

Description

  1. On the demo page for CKEditor 3.6.4, clear the screen.
  2. Type the two lines. Hit CR after typing the first line.

This is line 1.

This is line 2.

  1. Switch to source mode and you will see the following.
<p>
	This is line 1.</p>
<p>
	This is line 2.</p>
  1. While in source mode add a <br /> between the two p's as shown below.
<p>
	This is line 1.</p>
<br />
<p>
	This is line 2.</p>
  1. Switch out of source mode and then back to source mode and you will see the following invalid html.
<p>
	This is line 1.</p>
<p>
	&nbsp;</p>
<p>
	<br />
	<p>
		This is line 2.</p>
</p>
<p>
	&nbsp;</p>
  1. Notice that there is a p block within another p block. Also notice how the original html is modified by the insertion of p blocks with &nbsp;'s.

This is very problematic since we have many documents that exist with embedded br's and every time we save the files and reload them, they become more and more corrupt.

This worked properly in 3.6.2. No testing was done on 3.6.3.

Change History (12)

comment:1 Changed 7 years ago by Jakub Ś

Status: newconfirmed

Reproducible in all browsers from CKE 3.6.4 rev.[7526].

To reproduce just paste the below code and switch to WYSIWYG

<p>
	This is line 1.</p>
<br />
<p>
	This is line 2.</p>

IE produces:

<p>
	This is line 1.</p>
<p>
	&nbsp;</p>
<p>
	<br />
	<p>
		This is line 2.</p>
</p>
<p>
	&nbsp;</p>

All other browsers produce:

<p>
	This is line 1.</p>
<p>
	&nbsp;</p>
<p>
	This is line 2.</p>
<p>
	&nbsp;</p>

comment:2 Changed 7 years ago by Larry Hinderks

Also this case causes problems in 3.6.4 and IE 9 (maybe other browsers/versions)

To reproduce, type the following in source mode and then switch to WYSIWYG mode and then back to source mode

<br />
<table>
</table>

Results, for IE 9

<p>
	&nbsp;</p>
<p>
	<br />
	<table>
	</table>
</p>
<p>
	&nbsp;</p>

Results for Chrome

<p>
	&nbsp;</p>
<table>
</table>
<p>
	&nbsp;</p>

comment:3 Changed 7 years ago by Larry Hinderks

Also this case causes problems in 3.6.4 and IE 9 and Chrome (maybe other browsers/versions)

Many of our customers insert br's to space things in documents that are edited with CkEditor.

For some reason, CkEditor 3.6.4 changes br's to to p's in some cases, inserts p's and in general generates strange results when br's are used.

Earlier versions of Ckeditor left the br's intact. Converting br's to p's inserts extra spaces and modifies our customers layouts.

This is a huge problem for our customers with existing documents that they have constructed that contain br's.

Check out the case where the source has 2 ul lists seperated by 2 br's

To Reproduce type the following in source mode and then switch to WYSIWYG mode and then back to source mode

<ul>
</ul>
<br />
<br />
<ul>
</ul>

Results for IE9

<ul>
</ul>
<p>
	&nbsp;</p>
<p>
	<br />
	<p>
		&nbsp;</p>
</p>
<p>
	<br />
	<ul>
	</ul>
</p>
<p>
	&nbsp;</p>
<p>
	&nbsp;</p>

Results for Chrome

<ul>
</ul>
<p>
	&nbsp;</p>
<p>
	&nbsp;</p>
<ul>
</ul>
<p>
	&nbsp;</p>
<p>
	&nbsp;</p>

comment:4 Changed 7 years ago by Larry Hinderks

Here is a simple case that causes the same type of problem in ie including ie10.

This was done on the ckeditor demo site with version 3.6.5 (revision 7647) using ie9 and 10. IE 8 was not checked for this defect.

To Reproduce type the following in source mode and the switch to WYSIWYG and then back to source mode.

<br />
<p>line1</p>

Results for IE.

<p>
	&nbsp;</p>
<p>
	<br />
	<p>
		line1</p>
</p>
<p>
	&nbsp;</p>

Expected Results

<br />
<p>line1</p>

OR

<p>&nbsp;</p>
<p>line1</p>

comment:5 Changed 7 years ago by Garry Yao

@lhinderks: Turn off the autoParagraph configuration is enough to eliminiate BR in the above cases, from been converted to paragraph.

Leave this ticket open, as the current auto paragraphing result for BR is incorrect and is variant among browsers.

comment:6 Changed 7 years ago by Jakub Ś

Keywords: Oracle added

Another example:

Paste below in fullpage mode:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test page</title>
</head>
<body style="FONT-FAMILY: Arial; FONT-SIZE: 10pt" bgcolor="#DDE3DD">
<p>first paragraph</p>
<br />
<p>middle paragraph</p>
<p> </p>
<p> </p>
<p>second paragraph</p>
</body>
</html>

Result in IE

<body bgcolor="#dde3dd" style="font-size: 10pt; font-family: Arial">
		<p>
			first paragraph</p>
		<p>
			&nbsp;</p>
		<p>
			<br />
			<p>
				middle paragraph</p>
		</p>
		<p>
			&nbsp;</p>
		<p>
			&nbsp;</p>
		<p>
			&nbsp;</p>
		<p>
			second paragraph</p>
	</body>

Result in Modern browsers in CKE 3.x and all browsers in CKE 4.x (v4)

<body bgcolor="#DDE3DD" style="FONT-FAMILY: Arial; FONT-SIZE: 10pt">
		<p>
			first paragraph</p>
		<p>
			&nbsp;</p>
		<p>
			middle paragraph</p>
		<p>
			&nbsp;</p>
		<p>
			&nbsp;</p>
		<p>
			&nbsp;</p>
		<p>
			second paragraph</p>
	</body>

comment:7 Changed 7 years ago by Jakub Ś

Other tickets that were caused by this revision are: #9414 and #9203.

comment:8 Changed 7 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 4.0.1

Let's revert [7526] for now, which seems to be created because of this TC:

Source:
<p>foo</p><br />bar

Editor fixing before [7526]:
<p>foo</p><br /><p>bar</p>

... after [7526]:
<p>foo</p><p><br />bar</p>

Still we don't have a real TC issue for this case, so better to just open a ticket for it and wait for someone to raise the priority of this.

comment:9 Changed 6 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 4.0.1CKEditor 3.6.6

This is a v3 issue only.

comment:10 Changed 6 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: confirmedclosed

Fixed with [7676].

comment:11 Changed 6 years ago by Piotrek Koszuliński

This wasn't v3 issue only: #9912.

comment:12 in reply to:  11 Changed 6 years ago by Frederico Caldeira Knabben

Replying to Reinmar:

This wasn't v3 issue only: #9912.

Yes, it was. In v4 the behavior is different and desired.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy