Opened 13 years ago
Closed 8 years ago
#8545 closed Bug (duplicate)
Uncaught JS errors when destroying editor/textarea before fully loaded
Reported by: | Ildefonse | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 3.0 |
Keywords: | Cc: | chris.ingham@… |
Description
- Issue a jQuery adapter .ckeditor() call on a dynamically created element
- Destroy the element (e.g. popup, close again, remove from DOM), before the ckeditor() has fully loaded/initialized
- Several errors occur, depending on browser.
Chrome says: Uncaught TypeError: Cannot call method 'setHtml' of null (ckeditor.js, line 127) Firefox says: p is null [Break On This Error] (function(){var m;j.add('editingblock'...e==1&&D.getName() in f.$removeEmpty;
Of course, this only happens when you refresh/empty cache, and the ckeditor resources are not loaded yet. When they are in browser cache, the editor loads too quickly for this to be an issue.
It would be nice however, if there were some (better) checks in place, making sure that the elements are still there. If not, simply abort the loading process gracefully.
Let me know if you need more details.
Attachments (1)
Change History (10)
comment:1 Changed 13 years ago by
Status: | new → pending |
---|---|
Version: | 3.6.2 |
comment:5 Changed 13 years ago by
Sorry didn't have time yet... so much work. But i *will* try to do it either this or next week.
comment:6 Changed 13 years ago by
Status: | pending → confirmed |
---|---|
Version: | → 3.0 |
I'm attaching 3 files. Please put them in _samples folder.
- CKEditor JQuery dialog
To Reproduce
- Click on Create Instance button
- Before editor gets fully loaded click X on the dialog. This requires you to feel the right moment.
- I have managed to reproduce the issue with this sample from CKEditor 3.3.1
- CKEditor in YUI dialog - provided by @mrfr0g
To Reproduce
- Click on "Show (CRTL+Y)" button
- Before editor gets fully loaded press ESCAPE key. This also requires you to feel the right moment.
- I have managed to reproduce the issue with this sample from CKEditor 3.3.2
- I'm not sure if this sample is valid as when you remove the line
YAHOO.example.container.panel1.destroy();
you get no errors.
- Perhaps invalid sample but easiest way to reproduce.
To Reproduce
- Load the page in a browser
- I have managed to reproduce the issue with this sample from CKEditor 3.0
JS Error returned by samples:
Errors for 1 & 2 are only thrown when ckeditor.js is used.
Message: i.contentWindow is null
Line: 20
URI: ckeditor.js
2.
Message: i.contentWindow is null
Line: 149
URI: ckeditor.js
3.
Message: this.toolbox is undefined
Line: 387
URI: /ckeditor/_source/plugins/toolbar/plugin.js
Changed 13 years ago by
Attachment: | 3 files.zip added |
---|
comment:7 Changed 13 years ago by
I'm pasting the comment that rkoberg was trying to add:
This error still occurs in the released version and the nightly build as of today. It occurs when trying to hide an existing editor/textarea. It also occurs if I set the textarea editor to position:absolute;top-1000. Any workaround or fix? Where is the straight source to use to debug? I can only find the minified/packed version.
( Here is a slight fix, that gets you a little further, but then there is another error (L is null, in FF): http://www.lukerodgers.ca/2011/07/bug-in-ckeditor-version-3-6-1-revision-7072/ )
In firefox you get the error:
p is null
init(n="wysiwyg")ckeditor.js (line 128) init()ckeditor.js (line 128) getUrl(o=Object { _={...}, elementMode=1, element={...}, more...}, p=undefined, q=function(), r=function())ckeditor.js (line 6) getUrl(h="uiReady", i=undefined, j=Object { _={...}, elementMode=1, element={...}, more...})ckeditor.js (line 6) hasListeners(b="uiReady", c=undefined)ckeditor.js (line 7) getUrl(d="uiReady", e=undefined, f=Object { _={...}, elementMode=1, element={...}, more...})ckeditor.js (line 6) hasListeners(b="uiReady", c=undefined)ckeditor.js (line 7) build(o=Object { _={...}, elementMode=1, element={...}, more...}, p=undefined)ckeditor.js (line 149) fn()ckeditor.js (line 25) detect(u=[], v=[]) ...more
In Chrome you get the error:
Uncaught TypeError: Cannot call method 'setHtml' of null
a.editor.setModeckeditor.js:127 j.add.init.n.on.mckeditor.js:127 a.event.on.mckeditor.js:6 a.event.fireckeditor.js:6 a.editor.fireckeditor.js:7 a.event.fireOnceckeditor.js:6 a.editor.fireOnceckeditor.js:7 a.themes.add.build ...more
comment:9 Changed 8 years ago by
Resolution: | → duplicate |
---|---|
Status: | confirmed → closed |
This is in fact a duplicate of #11502
@Ildefonse you think it would be possible to provide a reduced test-case file showing the problem?