Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6476 closed Bug (invalid)

Line break character should not be inserted if elements only contain text nodes.

Reported by: Joe Kavanagh Owned by:
Priority: Normal Milestone:
Component: General Version: 3.5
Keywords: IBM Cc: Damian


The HTML writer inserts line break characters after closing the opening tag. For a table this results in the follow data being returned by editor.getData():

<table border="1" cellpadding="1" cellspacing="1" style="width: 500px;">
     The Table Caption</caption>

The additional line breaks have changed the data. The table caption that was entered by the user was "The Table Caption", whereas getData() returns "\nThe Table Caption". The table markup should be returned as:

<table border="1" cellpadding="1" cellspacing="1" style="width: 500px;">
  <caption>The Table Caption</caption>

Change History (4)

comment:1 Changed 8 years ago by Garry Yao

Status: newpending

@Joek, I don't get your point, what matters the line-break?

comment:2 Changed 8 years ago by Joe Kavanagh

CKEDITOR is altering the data that has been entered by the user by prefixing text data with line break characters. It should not alter data entered by the user.

To reproduce:

  1. Open the Ajax sample.
  1. Click on the "Create Editor" button to create an instance of the editor.
  1. Open the Table dialog and enter the text "The Table Caption" in the caption field.
  1. Click OK to insert the table.
  1. Click the "Remove Editor" button.
  1. Examine the generated HTML. The caption text is not equal "The Table Caption". It is "\n The Table Caption". Using Firefox & Firebug, enter the following statement in the Firebug console:

document.getElementsByTagName('caption')[0].textContent == "The Table Caption"

This evaluates to false. It should be true as you are comparing it to what you entered in the table caption field.

CKEDITOR.htmlWriter.openTagClose will add indentation and line break characters after every element. It should only do so if the next node is an element. Not if the next node is a text node.

comment:3 Changed 8 years ago by Garry Yao

Resolution: invalid
Status: pendingclosed

It doesn't seem to be a problem as it doesn't have any visual impact in wysiwyg mode, and <caption> are block-level element that is tolerant to leading white-spaces.

comment:4 Changed 8 years ago by Frederico Caldeira Knabben

This is HTML, and whitespace has no value here. It's just a matter of presentation.

@joek, if you really want it that way, you can freely control the output formatting as well.

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