﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
13614	CKEditor throws TypeError Exception when removed immediately after initialized	Dusty Jewett		"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.

"	Bug	closed	Normal		General	4.5.1	duplicate		
