Opened 12 years ago

Closed 12 years ago

#231 closed Bug (fixed)

Using <p><center></p> causes extra spacing in Firefox

Reported by: Ben Owned by:
Priority: Normal Milestone: FCKeditor 2.4.1
Component: General Version: FCKeditor 2.4
Keywords: Confirmed Cc:

Description

Let's say you have this code:

<p>text text text text</p>
<p><center>text text</center></p>
<p>text text text text</p>

Every time you save the code, it adds

<p>&nsbp;</p>

before and after the

<p><center>text text</center></p>

So if I save it 5 times, you end up with this:

<p>text text text text</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><center>text text</center></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>text text text text</p>

Removing the <center> tag fixes the problem.

Change History (3)

comment:1 Changed 12 years ago by Frederico Caldeira Knabben

Keywords: Confirmed added; center extra spacing removed
Summary: Using <center> causes extra spacing in FireFoxUsing <p><center></p> causes extra spacing in Firefox

Confirmed with both IE6 and FF2.

The thing is that this is the correct behavior (in part)! The provided code is invalid because both <p> and <center> are "block" elements. This is the job done by the browsers when parsing "<p><center>text text</center></p>":

  • <p> opens a new block;
  • <center> opens a new block, closing the previous one. So we have "<p></p><center>text text</center>" for now.
  • </p> is a invalid closing paragraph, that is fixed with a opening tag. So, now we have "<p></p><center>text text</center><p></p>".
  • The editor, fixes non block contents inside <body>, moving them to <p>. This is the buggy part here, resulting in "<p></p><p><center>text text</center></p><p></p>".

As <center> is an old HTML3 tag, not used by FCKeditor, it has been missed at our code. I'll be fixing it, so the following code, will be ok when pasting in the source:

<p>text text text text</p>
<center>text text</center>
<p>text text text text</p>

And this will be the only fix we can, and should, apply.

comment:2 Changed 12 years ago by Frederico Caldeira Knabben

Fixed with [204].

Click here for more info about our SVN system.

comment:3 Changed 12 years ago by Frederico Caldeira Knabben

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