Opened 8 years ago

Closed 6 years ago

#14256 closed Bug (fixed)

Range -> extractContents -> unexpected result

Reported by: Alexander Owned by:
Priority: Normal Milestone:
Component: Core : Selection Version: 4.5.4
Keywords: Support Cc:

Description (last modified by Jakub Ś)

Steps to reproduce

  1. Open CKEditor demo page -
  2. Select any text
  3. Open "dev tools"(F12) -> console
  4. Try to execute next code
currentRange = CKEDITOR.instances.editor1.getSelection().getRanges()[0];
clonedHTML = range.cloneContents().getHtml();
extractedHTML = range.extractContents().getHtml();

Expected result

clonedHTML and extractedHTML must be equal

Actual result

clonedHTML and extractedHTML are different

Other details (browser, OS, CKEditor version, installed plugins)

Reproducible in every browser starting from CKeditor 4.5.0

Change History (7)

comment:1 Changed 8 years ago by kkrzton

Status: newconfirmed

Running this code in a console:

var currentRange = CKEDITOR.instances.editor1.getSelection().getRanges()[0],
    clonedHTML = currentRange.cloneContents().getHtml(),
    extractedHTML = currentRange.extractContents().getHtml();

clonedHTML === extractedHTML;

there are some cases for which html differs - when part of the list or table is selected or source footer, e.g:

clonedHTML: <p>had three parts:</p><ol><li><strong>Command Module</strong> with a ca</li></ol>

extractedHTML: <p>had three parts:</p><ol><li> with a ca<strong>Command Module</strong></li></ol>

comment:2 Changed 8 years ago by Tomasz Jakut

Probably that problem is caused by bug in extractContents implementation, described in my comment for #13842 issue.

comment:3 Changed 6 years ago by Jakub Ś

Keywords: Range selection removed

Could be related #17030

Last edited 6 years ago by Jakub Ś (previous) (diff)

comment:4 Changed 6 years ago by Jakub Ś

#17033 was marked as duplicate.

TC from that ticket:

  1. Put attached sample into ckeditor/samples folder and open it
  2. Apply same styles and selections as in attached video:
    • This is some [sample text.] - apply yellow marker
    • This is [some sample text.] - apply underline
    • [This is some sample text.] - press Print Extract Contents button

Expected result

This is <u>some <span class="marker"><strong>sample text</strong>.</span></u>

comment:5 Changed 6 years ago by Jakub Ś

Keywords: Support added

comment:6 Changed 6 years ago by Jakub Ś

Description: modified (diff)

comment:7 Changed 6 years ago by kkrzton

Resolution: fixed
Status: confirmedclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy