rem: doctypeNode.removeAttribute("collapsed"); 
add: doctypeNode.collapsed = false; 
context: function SetEditMode(mode){  if (!IsHTMLEditor())    return;  var bodyElement = GetBodyElement();  if (!bodyElement)  {    dump("SetEditMode: We don't have a body node!\n");    return;  }  // must have editor if here!  var editor = GetCurrentEditor();  // 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 == kDisplayModeSource)  {    // Display the DOCTYPE as a non-editable string above edit area    var domdoc;    try { domdoc = editor.document; } catch (e) { dump( e + "\n");}    if (domdoc)    {      var doctypeNode = document.getElementById("doctype-text");      var dt = domdoc.doctype;      if (doctypeNode)      {        if (dt)        {          doctypeNode.removeAttribute("collapsed");          var doctypeText = "<!DOCTYPE " + domdoc.doctype.name;          if (dt.publicId)            doctypeText += " PUBLIC \"" + domdoc.doctype.publicId;          if (dt.systemId)            doctypeText += " "+"\"" + dt.systemId;          doctypeText += "\">"          doctypeNode.setAttribute("value", doctypeText);        }        else          doctypeNode.setAttribute("collapsed", "true");      }    }    // Get the entire document's source string    var flags = 256; // OutputEncodeEntities;    try {       var prettyPrint = gPrefs.getBoolPref("editor.prettyprint");      if (prettyPrint)        flags |= 2; // OutputFormatted    } catch (e) {}    var source = editor.outputToString(kHTMLMimeType, flags);    var start = source.search(/<html/i);    if (start == -1) start = 0;    gSourceContentWindow.value = source.slice(start);    gSourceContentWindow.focus();    // Add input handler so we know if user made any changes    gSourceContentWindow.addEventListener("input", oninputHTMLSource, false);    gHTMLSourceChanged = false;  }  else if (previousMode == kDisplayModeSource)  {    // Only rebuild document if a change was made in source window    if (gHTMLSourceChanged)    {      // Reduce the undo count so we don't use too much memory      //   during multiple uses of source window       //   (reinserting entire doc caches all nodes)      try {        editor.transactionManager.maxTransactionCount = 1;      } catch (e) {}      editor.beginTransaction();      try {        // We are comming from edit source mode,        //   so transfer that back into the document        source = gSourceContentWindow.value;        editor.rebuildDocumentFromSource(source);        // Get the text for the <title> from the newly-parsed document        // (must do this for proper conversion of "escaped" characters)        var title = "";        var titlenodelist = editor.document.getElementsByTagName("title");        if (titlenodelist)        {          var titleNode = titlenodelist.item(0);          if (titleNode && titleNode.firstChild && titleNode.firstChild.data)            title = titleNode.firstChild.data;        }        if (editor.document.title != title)          SetDocumentTitle(title);      } catch (ex) {        dump(ex);      }      editor.endTransaction();      // Restore unlimited undo count      try {        editor.transactionManager.maxTransactionCount = -1;      } catch (e) {}    } else {      // We don't need to call this again, so remove handler      gSourceContentWindow.removeEventListener("input", oninputHTMLSource, false);    }    gHTMLSourceChanged = false;    // Clear out the string buffers    gSourceContentWindow.value = null;    gContentWindow.focus();  }}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/b1c736039e4613f08fbb49d15711f0dbf686da2f/editor.js/buggy/editor/ui/composer/content/editor.js