Uncaught TypeError: Cannot read property 'hasAttribute' of undefined
|Reported by:||gcatalin||Owned by:|
I'm working on a project and we are using CKEditor 4.3.2. I have a test where each question is displayed in a new html page. But when i switch from one page to another i get the error "Uncaught TypeError: Cannot read property 'hasAttribute' of undefined".
I did some debug and i saw that this happens because the previous editor instance from the previous page (it has the same editor id) is still listening (although destroyed) to the "customConfigLoaded" event. So i guess it's catching the custom loaded config event in the new page.
And at the line:
a.readOnly = !(!c.readOnly && !(a.elementMode == CKEDITOR.ELEMENT_MODE_INLINE ? a.element.is("textarea") ? a.element.hasAttribute("disabled") : a.element.isReadOnly() : a.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE && a.element.hasAttribute("disabled")));
a.element is null because the editor was destroyed and a.status is "destroyed".
From what i could tell also, this listener is not removed in the removeAllListeners method, i see it's not part of the list of events to be removed.
Is there any way i can solve this without modifying the ckeditor code ? I have tried a lot of things but nothing seems to work.
Change History (11)
comment:1 Changed 3 years ago by Reinmar
- Keywords editor destroyed element undefined hasAttribute removed
- Status changed from new to pending
- Version 4.3.2 deleted
comment:3 Changed 3 years ago by Reinmar
- Resolution set to duplicate
- Status changed from pending to closed