Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#9949 closed Bug (invalid)

span display:none and body id="cke_pastebin" appearing in buffer

Reported by: Open eSignForms Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:


Since upgrading to CKEditor 4.0, we noticed that our data buffer can capture odd data. It may be because we transmit the contents of editor.getData() on blur so that we can send it to the server.

Here's a simple trace of an editor as type in A, then overwrite with B, then overwrite with C, and finally overwrite using a PASTE of "Please review to provide the records needed.":

* TRACE Received HTML (9) >>><p>A</p> <<< * TRACE Received HTML (9) >>><p>B</p> <<< * TRACE Received HTML (9) >>><p>C</p> <<< * TRACE Received HTML (257) >>><p><span style="display: none;">&nbsp;</span>C<span style="display: none;">&nbsp;</span></p> <body id="cke_pastebin" style="position: absolute; top: -6px; width: 1px; height: 218px; overflow: hidden; margin: 0px; padding: 0px; left: -1000px;">&nbsp;</body> <<< * TRACE Received HTML (52) >>><p>Please review to provide the records needed.</p> <<<

As you see, before we get the buffer that is correct after the paste, we also see two spans with display:none as well as an odd body tag for cke_pastebin. What might cause the buffer to contain such odd characters we clearly did not enter and then are automatically removed in short order?

I think the PASTE operation is causing a BLUR (we noted that if we even click below the last line of text in the editor window, we get a blur and focus event as if the click loses the focus and then gets it back) and so we are seeing this interim value. It seems that the two empty SPAN tags surround the highlighted text that I then replaced with the PASTE. If we PASTE to just append text rather than also overwrite, we noted only one SPAN is inserted.

It appears to happen on Chrome, Safari and FF, but not IE9 or Opera.

(As reported in the forums:

Change History (5)

comment:1 Changed 11 years ago by Jakub Ś

Status: newpending

And again:

This it not enough information.

  1. Which editor do you use 3.x or 4.x (I assume the second but please confirm)? We had similar issues some time ago #5144, #6382, #9549 but they were all fixed. Are yu using some old editor?
  2. Could you provide reduced sample showing the problem (I'm talking about same html page that can be put in samples folder and will show the problem)?
  3. Could you provide detailed steps that explain how to reproduce this problem?
  4. Can this be reproduced in plain and fresh CKEditor without any customizations or this problem occur in your webapp or in customized editor?

Please reply to all questions.

comment:2 Changed 11 years ago by Open eSignForms

Yes, this is under 4.0.1. I saw those bug reports, yet I still see it occur.

Sadly, I doubt this can be reproduced in the demo editor because it needs to act on the 'blur' event where it retrieves the editor.getData() to see it. The editor contents have the buggy contents only for a brief time, but long enough to be there when we retrieve it in the blur event handler where we ship the contents back to the server.

I suspect it has something to do with "force blur" since the editor already defaults to having a 100msec delay on emitting the blur event, as if there's a known issue with quick blur-then-focus events firing so that they do not occur unless the 'nodelay' option is used.

In 3.x we used this to make blur be forceBlur:

CKEDITOR.focusManager.prototype['blur'] =  CKEDITOR.focusManager.prototype['forceBlur'];

In 4.0.1 we're doing this to simulate that:

CKEDITOR.focusManager.prototype.orig_blur = CKEDITOR.focusManager.prototype.blur;
CKEDITOR.focusManager.prototype.blur = function() {,true); };
Last edited 11 years ago by Open eSignForms (previous) (diff)

comment:3 Changed 11 years ago by Jakub Ś

Resolution: invalid
Status: pendingclosed
Version: 4.0.1

The editor contents have the buggy contents only for a brief time

Why not adding setTimeout? It is possible that for a brief of time there are some browser leftovers which CKEditor cleans. In such case setting delay seems like a good solution.

Taking the above into account I assume that this problem can't be reproduced in plain CKEditor without any custom changes or plugins thus I will have to close it as invalid.
If this issue is valid, could you please provide reduced sample showing the problem (I'm talking about same html page that can be put in samples folder and will show the problem) or piece of code with description where should be put or custom plugin. I will reopen this ticket then.

comment:4 Changed 11 years ago by Open eSignForms

It's probably related to ticket 9948 and the example there. If the force blur concept is no longer a valid scenario (in which you will see the extra focus/blur events firing), then both 9948 and this ticket are invalid.

But it seems to me that the blur/focus events are firing, just being suppressed by the fact that blur waits 100msecs (a number that sounds arbitrary and was used because it seems to hold true, but in fact may not hold true depending on the browser type, speed, load, etc. of the client).

It would be better if the blur/focus events didn't fire at all unless the editor actually loses/gains focus since a PASTE and right-click in a TABLE CELL should not cause either event to fire it would seem to me.

comment:5 Changed 11 years ago by Open eSignForms

Please see forum posting:

This shows the issue with blur/focus not firing correctly, buffer mismatches, etc. using just CKEditor in HTML.

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