rem: var source = editorShell.GetContentsAs("text/html", 0); if (source.length > 0) {  headStart = source.indexOf("<head"); if (headStart > 0) gSourceContentWindow.value = source.slice(headStart); else headStart = source; 
context: function SetEditMode(mode){  if (gIsHTMLEditor)  {    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 = gEditorDisplayMode;    if (!SetDisplayMode(mode))      return;    if (mode == DisplayModeSource)    {      // Get the entire document's source string      var source = editorShell.GetContentsAs("text/html", 0);      if (source.length > 0)      {        // Don't include anything before "<head", such as "<DOCTYPE..."        headStart = source.indexOf("<head");        if (headStart > 0)          gSourceContentWindow.value = source.slice(headStart);        else          headStart = source;        gSourceContentWindow.focus();      }      else        SetDisplayMode(PreviousNonSourceDisplayMode);    }    else if (previousMode == DisplayModeSource)     {      // We are comming from edit source mode,      //   so transfer that back into the document      editorShell.RebuildDocumentFromSource(gSourceContentWindow.value);      // Clear out the source editor buffer      gSourceContentWindow.value = "";      // reset selection to top of doc (wish we could preserve it!)      if (bodyNode)        editorShell.editorSelection.collapse(bodyNode, 0);      window._content.focus();    }  }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/08508c8980d1c35f19277ad8844148b2f34689eb/editor.js/buggy/editor/ui/composer/content/editor.js