Opened 9 years ago

Last modified 8 years ago

#7824 confirmed Bug

Cannot call method 'split' of undefined on CKEDITOR.replace

Reported by: Michael Camden Owned by:
Priority: Normal Milestone:
Component: General Version: 3.5.3
Keywords: review? Cc: mcamden@…, WebSpellChecker.net

Description

Our page has several divs that are placeholders for CKEDITOR instances. When a user clicks on one, it closes the active editor, and creates a new instance of CKEDITOR on the clicked div using CKEDITOR.replace. When you have an editor instance open, right click to open the context menu twice, and click on another div to open the editor, I get this error.

Cannot call method 'split' of undefined

This error only occurs when I am using ckeditor.js and not ckeditor_source.js. I've tracked the error down to line 23 of ckeditor.js. Here is a snippet of the issue:

q=function(x){var y=x.config.skin.split(','),z=y[0],A=a.getUrl(y[1]||'skins/'+z+'/');

Interestingly, I cannot find any reference in the source to 'config.skin.split'. It seems that this only exists in the ckeditor.js file.

Steps to reproduce:

  1. Start out on a page with two div elements with ids, 'editor1', 'editor2'.
  2. Use CKEDITOR.replace to replace 'editor1'
  3. Right click on the active editor to activate the context menu
  4. Left click on the active editor, not clicking on the menu items
  5. Repeat Step 3
  6. Repeat Step 4
  7. Use CKEDITOR.replace to replace 'editor2'

Tested in Chrome, IE8/9

Attachments (1)

ckeditor_7824.html (1.3 KB) - added by Michael Camden 9 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 9 years ago by Jakub Ś

Status: newpending

You it would be possible to provide us with a sample file?

Changed 9 years ago by Michael Camden

Attachment: ckeditor_7824.html added

comment:2 Changed 9 years ago by Michael Camden

Please see attached file. It also includes the steps to reproduce this bug.

comment:3 Changed 9 years ago by Frederico Caldeira Knabben

Cc: WebSpellChecker.net added
Keywords: error CKEDITOR.replace removed
Status: pendingconfirmed

I've confirmed the error in the provided TC with both FF and IE.

Just for reference, we're talking about line 115 of editor.js. For some unknown reason, editor.config gets mangled and becomes an invalid object.

To note that this happens only when enabling SCAYT, This tells me that this issue is much probably related to the load of SCAYT core from SpellChecker.net.

comment:4 Changed 9 years ago by WebSpellChecker.net

This is duplicate of #7697

comment:5 in reply to:  4 Changed 9 years ago by Frederico Caldeira Knabben

Replying to SpellChecker.net:

This is duplicate of #7697

This ticket cannot be a DUP of #7697 because that one is already closed and I can still confirm the issue on the current trunk.

comment:6 Changed 9 years ago by WebSpellChecker.net

The original patch - https://dev.ckeditor.com/attachment/ticket/7697/7697.patch have contained declaration of loop variable as 'var' in both loops. This prevents of mixing of variables names when minifying a version. But in changeset [6876] you've removed a "var" in the second loop by some reason. What we have observed is that problem is reproduced on 3.5.3 release available for download. If the same version will be built from sources in different environment the problem might not be reproduced. But with the "var" declaration of loop variable in the second loop the problem can not be reproduced in our environment.

comment:7 Changed 9 years ago by WebSpellChecker.net

Keywords: Confirmed added

We can reproduce this problem on trunk.

comment:8 Changed 9 years ago by Frederico Caldeira Knabben

Keywords: Confirmed removed

If we add "var m" at line 671, it'll be a redeclaration of that variable, which is wrong (just like the previous patch).

Additionally, there is no justification for that "var" being the responsible for the fix. This is the minified version of that code (I've added one ENTER):

for(var M in w){delete t._.menuItems[M];delete t._.commands[M];}
for(M in x){delete t._.menuItems[M];delete t._.commands[M];}

Something else must be wrong here.

comment:9 Changed 9 years ago by WebSpellChecker.net

While we were investigating the problem we have found issue with 'htmlFilter' and 'dataFilter' used in SCAYT plugin. If we comment out line 241:

delete element.name;

and lines 527, 528:

if ( attrs && attrs[ 'data-scaytid' ] )
   delete element.name;

then the problem cannot be reproduced. We tried to review 'dataProcessor' code and found that there are similar filtering rules for

<span class="Apple-style-span">sample</span>

We tried to put such markup in to the editor and were able to reproduce the problem on nightly build (http://nightly.ckeditor.com/6956/_samples/). No need to enable SCAYT to reproduce the problem.

Steps to reproduce:

  1. Open Replace DIV sample http://nightly.ckeditor.com/6956/_samples/divreplace.html
  2. Double-click to enable the editor
  3. Switch to source mode
  4. Paste <span class="Apple-style-span">sample</span>
  5. Switch to WYSIWYG
  6. Double-click other DIV

Expected results: editor switched to other DIV

Real results: described error observed

comment:10 Changed 8 years ago by WebSpellChecker.net

Keywords: review? added

Looks like this issue is fixed by #8000 .
We are not able to reproduce the issue on latest nightly build: http://nightly.ckeditor.com/7045/_samples/divreplace.html

comment:11 Changed 8 years ago by aaronransley

Disregard/delete this

Last edited 8 years ago by aaronransley (previous) (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy