rem: var bodyNode = editorShell.editorDocument.getElementsByTagName("body").item(0); if (!bodyNode) 
add: if (gIsHTMLEditor) 
context: function SetEditMode(mode){  var bodyNode = editorShell.editorDocument.getElementsByTagName("body").item(0);  if (!bodyNode)  {    dump("SetEditMode: We don't have a body node!\n");    return;  }  // Switch the UI mode before inserting contents  //   so user can't type in source window while new window is being filled  var previousMode = EditorDisplayMode;  if (!SetDisplayMode(mode))    return;  if (mode == DisplayModeSource)  {    // Get the current contents and output into the SourceWindow    if (bodyNode)    {      var childCount = bodyNode.childNodes.length;      if( childCount)      {        // KLUDGE until we have an output flag that strips out <body> and </body> for us        var sourceContent = editorShell.GetContentsAs("text/html", gOutputBodyOnly);        sourceContentWindow.value = sourceContent.replace(/<body>/,"").replace(/<\/body>/,"");        sourceContentWindow.focus();        setTimeout("sourceContentWindow.focus()", 10);        return;      }    }    // If we fall through, revert to previous node    SetDisplayMode(PreviousNonSourceDisplayMode);  }  else if (previousMode == DisplayModeSource)   {    // We are comming from edit source mode,    //   so transfer that back into the document    editorShell.SelectAll();    editorShell.InsertSource(sourceContentWindow.value);    // Clear out the source editor buffer    sourceContentWindow.value = "";    // reset selection to top of doc (wish we could preserve it!)    if (bodyNode)      editorShell.editorSelection.collapse(bodyNode, 0);    contentWindow.focus();    setTimeout("contentWindow.focus()", 10);  }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/7eedb58c104c053baf19ad0ec2d93622357c4dbd/editor.js/clean/editor/ui/composer/content/editor.js