Opened 10 years ago

Closed 10 years ago

#3656 closed Bug (fixed)

CKEDITOR.dom.range::trim() is destroying text ranges.

Reported by: Martin Kou Owned by: Martin Kou
Priority: Normal Milestone: CKEditor 3.0
Component: General Version: SVN (CKEditor) - OLD
Keywords: Review+ Cc:

Description

To reproduce:

  1. Open replacebyclass.html.
  2. Run the following in Firebug console, or any browser console that allows JavaScript execution:
    var p = CKEDITOR.dom.element.createFromHtml
    ('<p>abcdabcd</p>');
    var range = new CKEDITOR.dom.range();
    range.setStart(p.getFirst(), 2);
    range.setEnd(p.getFirst(), 6);
    console.log(range.collapsed);
    range.trim();
    console.log(range.collapsed);
    
  3. range becomes collapsed after running trim() on a non-empty text range, this is wrong.

Attachments (2)

3656.patch (894 bytes) - added by Martin Kou 10 years ago.
3656_2.patch (2.1 KB) - added by Garry Yao 10 years ago.

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by Martin Kou

Attachment: 3656.patch added

comment:1 Changed 10 years ago by Martin Kou

Keywords: Review? added

comment:2 Changed 10 years ago by Martin Kou

This bug is caused by endContainer and endOffset being improperly updated after the first part of trim() changed this.endContainer and this.endOffset.

Changed 10 years ago by Garry Yao

Attachment: 3656_2.patch added

comment:3 Changed 10 years ago by Garry Yao

R+ for 3656.patch, appending TC.

comment:4 Changed 10 years ago by Garry Yao

Keywords: Review+ added; Review? removed

comment:5 Changed 10 years ago by Martin Kou

Resolution: fixed
Status: newclosed

Fixed with [3624].

Click here for more info about our SVN system.

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