Opened 3 years ago

Closed 3 years ago

#14678 closed Bug (invalid)

TypeError: Cannot read property 'setAttribute' of undefined

Reported by: sweta Owned by:
Priority: Normal Milestone:
Component: File Browser Version:
Keywords: Cc:

Description

Currently I am using ckeditor version 4.5.7. and in this version I am facing issue with "Uncaught TypeError: Cannot read property 'setAttribute' of undefined" for body element. Code is as below. Its working fine in firefox. But problem with ie and chrome.

edtr = CKEDITOR.replace(id, {

on: {

'instanceReady': function(evt) {

insert = CKEDITOR.getTemplates('default');

var editor = evt.editor; var body = editor.document.getBody(); body.setAttribute("contentEditable", false);

var disableEvent = function(evt) {

evt.cancelBubble = true; evt.returnValue = false; evt.preventDefault(); evt.stopPropagation();

return false;

};

if (editor.document.$.addEventListener) {

editor.document.$.addEventListener('dragover', disableEvent, true); editor.document.$.addEventListener('drop', disableEvent, true);

} else if (editor.document.$.attachEvent) {

editor.document.$.attachEvent('ondragover', disableEvent, true); editor.document.$.attachEvent('ondrop', disableEvent, true);

} this.fire('afterSetData', main.pageContainerEmailEditor.emaileditor.afterSetData());

}

}

});

Attachments (2)

setAttribute_Err.png (86.0 KB) - added by sweta 3 years ago.
basic.html (5.5 KB) - added by sweta 3 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 3 years ago by Jakub Ś

Status: newpending
Version: 4.5.7

Please provide more detail as I could not reproduce it.

  1. I have tried your code and it works ok but there is also a call to afterSetData which is your custom method and may cause the problem.
  2. When exactly does this error occur - on load or there is some specific scenario. Please provide detailed steps to reproduce it.
  3. Please try reproducing this issue in default standalone CKEditor outside of your application in order to exclude influence of e.g. third-party scripts. Only such issue
  4. Please provide reduced HTML filewhich I could put into ckeditor/samples folder and see the issue.

Changed 3 years ago by sweta

Attachment: setAttribute_Err.png added

Changed 3 years ago by sweta

Attachment: basic.html added

comment:2 Changed 3 years ago by sweta

Thanks for your quick reply.

1) I have created basic template in ckeditor to load every time when ckeditor render.

2) HTML code of this basic template is attached here in basic.html.

3) In that central td's are contentEditable=true always.But cannot insert characters, symbols, numbers..etc. Its like empty box.

4) In this central part of basic template we can put ck widgets and we can move, delete, apply css, and copy ck widgets.

5) So some time when I render ckeditor in my page I am getting issue TypeError: Cannot read property 'setAttribute' of undefined and sometime not.

6) I am getting this error at ckeditor.js line no 99.

setAttribute:function(){var a=function(a,b){this.$.setAttribute(a, b);return this};

comment:3 Changed 3 years ago by Jakub Ś

Resolution: invalid
Status: pendingclosed

I have tried your basic.html template and code you have provided. Still no luck.

Since I can't reproduce this issue, you are getting it only sometimes and you are getting it with your custom widget implementation, it really looks like implementation issue and not ckeditor bug. Because of that I need to close this issue as invalid for now.

In order to have it reopened and confirmed, I need you to provide reduced and working sample file/files (html, JS, CSS and whatever is needed) that can be put into default CKEditor and will show this issue.

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