Opened 9 years ago

Closed 9 years ago

#13614 closed Bug (duplicate)

CKEditor throws TypeError Exception when removed immediately after initialized

Reported by: Dusty Jewett Owned by:
Priority: Normal Milestone:
Component: General Version: 4.5.1
Keywords: Cc:

Description

JS Fiddle here: http://jsfiddle.net/dustyjewett/2Lpa6pjm/1/

Steps to reproduce

  1. Initialize CKEditor in a page
  2. Remove DOM element immediately

Expected result

DOM element removed, no exceptions

Actual result

TypeError thrown.

Use Case

Single Page apps now create/destroy the DOM as needed to render the user display. In the normal case of events, it is likely that these types of exceptions are an indicator of DOM thrashing... creating/destroying DOM/objects that are wasteful. During unit/acceptance tests, however, it is extremely common to create/destroy objects in quick succession.

Other details (browser, OS, CKEditor version, installed plugins)

Default plugins, all browsers.

-- Assumptions below, grain of salt advised --

This exception occurs because of the numerous setTimeout() used during/around initialization of ckeditor and various plugins. wysiwygarea and autogrow are the specific plugins that have caused me the most grief.

While it's unfortunate that setTimeout() is used so often, these plugins should guard against the possibility that the state of the editor has changed since setTimeout() was originally called.

The ideal way to fix this is to provide a guard in the tools.setTimeout (or, a new safeSetTimeout method) that checks for the existence of the DOM elements required before firing.

A stopgap before something like this can be designed/implemented would be to add guards to the core usages of setTimeout.

Change History (1)

comment:1 Changed 9 years ago by Dusty Jewett

Resolution: duplicate
Status: newclosed

Never mind, Duplicate of #11502... I hadn't looked that far back.

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