Index: /trunk/htmlarea.js
===================================================================
--- /trunk/htmlarea.js (revision 519)
+++ /trunk/htmlarea.js (revision 526)
@@ -2227,16 +2227,20 @@
 };
   
-/** Delay a function until the document is ready for operations.  See ticket:547 */
-HTMLArea.prototype.whenDocReady = function(doFunction)
-{
-  var editor = this;  
-  
-  if ( !this._doc.body )
-  {
-    setTimeout(function() { editor.whenDocReady(doFunction); }, 50);
+/**
+ * Delay a function until the document is ready for operations.
+ * See ticket:547
+ * @param {object} F (Function) The function to call once the document is ready
+ * @public
+ */
+HTMLArea.prototype.whenDocReady = function(F)
+{
+  var E = this;
+  if ( this._doc && this._doc.body )
+  {
+    F();
   }
   else
   {
-    doFunction();
+    setTimeout(function() { E.whenDocReady(F); }, 50);
   }
 };
