Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#4622 closed Bug (fixed)

Pasting table twice will corrupt undo buffer

Reported by: pomu0325 Owned by: garry.yao
Priority: Normal Milestone: CKEditor 3.2
Component: Core : Undo & Redo Version: SVN (CKEditor) - OLD
Keywords: Confirmed Review+ Cc:


  • Open CKEditor demo
  • Select the table at the right side
  • Copy the table by Ctrl+C or by the toolbar icon
  • Paste the table anywhere in the editor
  • Paste it on another place again
  • Undo by Ctrl+Z or by the toolbar icon
  • Undo again, then the 1st table pasted will remain still.

Attachments (1)

4622.patch (611 bytes) - added by garry.yao 7 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by fredck

  • Keywords Confirmed added
  • Milestone set to CKEditor 3.2

Confirmed with IE. Firefox is also not giving good results here, and it's not possible to redo after undo also.

comment:2 Changed 7 years ago by garry.yao

  • Owner set to garry.yao
  • Status changed from new to assigned
  • Version set to SVN (CKEditor)

It's caused by the irreversible IE DOM manipulate with table, suppose we have the following DOM structure:


Retrieving from body element will result in a schema-violated HTML:

var html = body.innerHTML; //<p><table>...</table></p> 

While sending the retrieved snipper back to body, IE becomes quite strict, where invalid HTML will be fixed:

body.innerHTML = html; //<p></p><table>...</table> 

This will confuse our undo system to consider two DOM structures are "different" while actually they're originate from the same snapshot.

Changed 7 years ago by garry.yao

comment:3 Changed 7 years ago by garry.yao

  • Keywords Review? added

The solution is as simple as updating the original snapshot image in undo stack with the actual result DOM image.

comment:4 Changed 7 years ago by garry.yao

Taking similar behaviors from other browsers into consideration, I haven't made it an IE-dedicated fix.

comment:5 Changed 7 years ago by alfonsoml

  • Keywords Review+ added; Review? removed

#4787 was the same problem and it's also fixed by the patch.

comment:6 Changed 7 years ago by garry.yao

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed with [5005].

comment:7 Changed 7 years ago by garry.yao

#4674 has been marked as a duplicate.

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