Bug 1542666 - Turn on ESLint in editor (automatic changes by eslint --fix); rs=me
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 09 Apr 2019 11:57:12 +1200
changeset 34168 2f1b233c4f65d26b0dc3ff3236758b73759cc25a
parent 34167 455b5241d71d386bbb88c44163b5cf82908ab2f2
child 34169 09d757485ede721d43560f4fb42b8a6e7c2b6e9b
push id2407
push userclokep@gmail.com
push dateMon, 20 May 2019 17:11:26 +0000
treeherdercomm-beta@193428fd6fd4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1542666
Bug 1542666 - Turn on ESLint in editor (automatic changes by eslint --fix); rs=me
.eslintignore
editor/ui/composer/content/ComposerCommands.js
editor/ui/composer/content/editor.js
editor/ui/composer/content/editorUtilities.js
editor/ui/dialogs/content/EdAEAttributes.js
editor/ui/dialogs/content/EdAECSSAttributes.js
editor/ui/dialogs/content/EdAEHTMLAttributes.js
editor/ui/dialogs/content/EdAEJSEAttributes.js
editor/ui/dialogs/content/EdAdvancedEdit.js
editor/ui/dialogs/content/EdButtonProps.js
editor/ui/dialogs/content/EdColorPicker.js
editor/ui/dialogs/content/EdColorProps.js
editor/ui/dialogs/content/EdConvertToTable.js
editor/ui/dialogs/content/EdDialogCommon.js
editor/ui/dialogs/content/EdDialogTemplate.js
editor/ui/dialogs/content/EdDictionary.js
editor/ui/dialogs/content/EdFieldSetProps.js
editor/ui/dialogs/content/EdFormProps.js
editor/ui/dialogs/content/EdHLineProps.js
editor/ui/dialogs/content/EdImageDialog.js
editor/ui/dialogs/content/EdImageLinkLoader.js
editor/ui/dialogs/content/EdImageProps.js
editor/ui/dialogs/content/EdInputImage.js
editor/ui/dialogs/content/EdInputProps.js
editor/ui/dialogs/content/EdInsSrc.js
editor/ui/dialogs/content/EdInsertChars.js
editor/ui/dialogs/content/EdInsertMath.js
editor/ui/dialogs/content/EdInsertTOC.js
editor/ui/dialogs/content/EdInsertTable.js
editor/ui/dialogs/content/EdLabelProps.js
editor/ui/dialogs/content/EdLinkProps.js
editor/ui/dialogs/content/EdListProps.js
editor/ui/dialogs/content/EdNamedAnchorProps.js
editor/ui/dialogs/content/EdPageProps.js
editor/ui/dialogs/content/EdReplace.js
editor/ui/dialogs/content/EdSelectProps.js
editor/ui/dialogs/content/EdSpellCheck.js
editor/ui/dialogs/content/EdTableProps.js
editor/ui/dialogs/content/EdTextAreaProps.js
editor/ui/editorUtilities.jsm
editor/ui/nsComposerCmdLineHandler.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -20,29 +20,51 @@ testing/**
 calendar/base/content/calendar-calendars-list.xul
 calendar/providers/gdata/content/gdata-calendar-creation.xul
 common/src/viewSource.xul
 
 # We ignore all these directories by default, until we get them enabled.
 # If you are enabling a directory, please add directory specific exclusions
 # below.
 build/**
-editor/**
 ldap/**
 suite/**
 
 # chat exclusions
 chat/chat-prefs.js
 # third-party code
 chat/modules/BigInteger.jsm
 chat/protocols/matrix/matrix-sdk/**
 chat/protocols/twitter/twitter-text.jsm
 # preprocessed files
 chat/content/imtooltip.xml
 
+# editor exclusions (most files not shipped with Thunderbird)
+editor/ui/composer.js
+editor/ui/composer/content/**
+!editor/ui/composer/content/editor.js
+!editor/ui/composer/content/editorUtilities.js
+!editor/ui/composer/content/ComposerCommands.js
+editor/ui/dialogs/content/EditConflict.js
+editor/ui/dialogs/content/EditConflict.xul
+editor/ui/dialogs/content/EditorPublish.js
+editor/ui/dialogs/content/EditorPublish.xul
+editor/ui/dialogs/content/EditorPublishOverlay.xul
+editor/ui/dialogs/content/EditorPublishProgress.js
+editor/ui/dialogs/content/EditorPublishProgress.xul
+editor/ui/dialogs/content/EditorPublishSettings.js
+editor/ui/dialogs/content/EditorPublishSettings.xul
+editor/ui/dialogs/content/EditorSaveAsCharset.js
+editor/ui/dialogs/content/EditorSaveAsCharset.xul
+editor/ui/dialogs/content/EdLinkChecker.js
+editor/ui/dialogs/content/EdLinkChecker.xul
+editor/ui/dialogs/content/EdSnapToGrid.js
+editor/ui/dialogs/content/EdSnapToGrid.xul
+editor/ui/texzilla/**
+
 # mailnews exclusions
 mailnews/mailnews.js
 mailnews/base/content/*
 mailnews/base/prefs/*
 mailnews/base/search/*
 mailnews/base/src/*
 mailnews/base/util/*
 mailnews/build/*
--- a/editor/ui/composer/content/ComposerCommands.js
+++ b/editor/ui/composer/content/ComposerCommands.js
@@ -3,108 +3,105 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Implementations of nsIControllerCommand for composer commands */
 
 var gComposerJSCommandControllerID = 0;
 
 
-//-----------------------------------------------------------------------------------
-function SetupHTMLEditorCommands()
-{
+// -----------------------------------------------------------------------------------
+function SetupHTMLEditorCommands() {
   var commandTable = GetComposerCommandTable();
   if (!commandTable)
     return;
 
   // Include everything a text editor does
   SetupTextEditorCommands();
 
-  //dump("Registering HTML editor commands\n");
+  // dump("Registering HTML editor commands\n");
 
   commandTable.registerCommand("cmd_renderedHTMLEnabler", nsDummyHTMLCommand);
 
-  commandTable.registerCommand("cmd_grid",  nsGridCommand);
-
-  commandTable.registerCommand("cmd_listProperties",  nsListPropertiesCommand);
-  commandTable.registerCommand("cmd_pageProperties",  nsPagePropertiesCommand);
+  commandTable.registerCommand("cmd_grid", nsGridCommand);
+
+  commandTable.registerCommand("cmd_listProperties", nsListPropertiesCommand);
+  commandTable.registerCommand("cmd_pageProperties", nsPagePropertiesCommand);
   commandTable.registerCommand("cmd_colorProperties", nsColorPropertiesCommand);
   commandTable.registerCommand("cmd_increaseFontStep", nsIncreaseFontCommand);
   commandTable.registerCommand("cmd_decreaseFontStep", nsDecreaseFontCommand);
   commandTable.registerCommand("cmd_advancedProperties", nsAdvancedPropertiesCommand);
-  commandTable.registerCommand("cmd_objectProperties",   nsObjectPropertiesCommand);
+  commandTable.registerCommand("cmd_objectProperties", nsObjectPropertiesCommand);
   commandTable.registerCommand("cmd_removeNamedAnchors", nsRemoveNamedAnchorsCommand);
-  commandTable.registerCommand("cmd_editLink",        nsEditLinkCommand);
-
-  commandTable.registerCommand("cmd_form",          nsFormCommand);
-  commandTable.registerCommand("cmd_inputtag",      nsInputTagCommand);
-  commandTable.registerCommand("cmd_inputimage",    nsInputImageCommand);
-  commandTable.registerCommand("cmd_textarea",      nsTextAreaCommand);
-  commandTable.registerCommand("cmd_select",        nsSelectCommand);
-  commandTable.registerCommand("cmd_button",        nsButtonCommand);
-  commandTable.registerCommand("cmd_label",         nsLabelCommand);
-  commandTable.registerCommand("cmd_fieldset",      nsFieldSetCommand);
-  commandTable.registerCommand("cmd_isindex",       nsIsIndexCommand);
-  commandTable.registerCommand("cmd_image",         nsImageCommand);
-  commandTable.registerCommand("cmd_hline",         nsHLineCommand);
-  commandTable.registerCommand("cmd_link",          nsLinkCommand);
-  commandTable.registerCommand("cmd_anchor",        nsAnchorCommand);
+  commandTable.registerCommand("cmd_editLink", nsEditLinkCommand);
+
+  commandTable.registerCommand("cmd_form", nsFormCommand);
+  commandTable.registerCommand("cmd_inputtag", nsInputTagCommand);
+  commandTable.registerCommand("cmd_inputimage", nsInputImageCommand);
+  commandTable.registerCommand("cmd_textarea", nsTextAreaCommand);
+  commandTable.registerCommand("cmd_select", nsSelectCommand);
+  commandTable.registerCommand("cmd_button", nsButtonCommand);
+  commandTable.registerCommand("cmd_label", nsLabelCommand);
+  commandTable.registerCommand("cmd_fieldset", nsFieldSetCommand);
+  commandTable.registerCommand("cmd_isindex", nsIsIndexCommand);
+  commandTable.registerCommand("cmd_image", nsImageCommand);
+  commandTable.registerCommand("cmd_hline", nsHLineCommand);
+  commandTable.registerCommand("cmd_link", nsLinkCommand);
+  commandTable.registerCommand("cmd_anchor", nsAnchorCommand);
   commandTable.registerCommand("cmd_insertHTMLWithDialog", nsInsertHTMLWithDialogCommand);
   commandTable.registerCommand("cmd_insertMathWithDialog", nsInsertMathWithDialogCommand);
-  commandTable.registerCommand("cmd_insertBreak",   nsInsertBreakCommand);
-  commandTable.registerCommand("cmd_insertBreakAll",nsInsertBreakAllCommand);
-
-  commandTable.registerCommand("cmd_table",              nsInsertOrEditTableCommand);
-  commandTable.registerCommand("cmd_editTable",          nsEditTableCommand);
-  commandTable.registerCommand("cmd_SelectTable",        nsSelectTableCommand);
-  commandTable.registerCommand("cmd_SelectRow",          nsSelectTableRowCommand);
-  commandTable.registerCommand("cmd_SelectColumn",       nsSelectTableColumnCommand);
-  commandTable.registerCommand("cmd_SelectCell",         nsSelectTableCellCommand);
-  commandTable.registerCommand("cmd_SelectAllCells",     nsSelectAllTableCellsCommand);
-  commandTable.registerCommand("cmd_InsertTable",        nsInsertTableCommand);
-  commandTable.registerCommand("cmd_InsertRowAbove",     nsInsertTableRowAboveCommand);
-  commandTable.registerCommand("cmd_InsertRowBelow",     nsInsertTableRowBelowCommand);
+  commandTable.registerCommand("cmd_insertBreak", nsInsertBreakCommand);
+  commandTable.registerCommand("cmd_insertBreakAll", nsInsertBreakAllCommand);
+
+  commandTable.registerCommand("cmd_table", nsInsertOrEditTableCommand);
+  commandTable.registerCommand("cmd_editTable", nsEditTableCommand);
+  commandTable.registerCommand("cmd_SelectTable", nsSelectTableCommand);
+  commandTable.registerCommand("cmd_SelectRow", nsSelectTableRowCommand);
+  commandTable.registerCommand("cmd_SelectColumn", nsSelectTableColumnCommand);
+  commandTable.registerCommand("cmd_SelectCell", nsSelectTableCellCommand);
+  commandTable.registerCommand("cmd_SelectAllCells", nsSelectAllTableCellsCommand);
+  commandTable.registerCommand("cmd_InsertTable", nsInsertTableCommand);
+  commandTable.registerCommand("cmd_InsertRowAbove", nsInsertTableRowAboveCommand);
+  commandTable.registerCommand("cmd_InsertRowBelow", nsInsertTableRowBelowCommand);
   commandTable.registerCommand("cmd_InsertColumnBefore", nsInsertTableColumnBeforeCommand);
-  commandTable.registerCommand("cmd_InsertColumnAfter",  nsInsertTableColumnAfterCommand);
-  commandTable.registerCommand("cmd_InsertCellBefore",   nsInsertTableCellBeforeCommand);
-  commandTable.registerCommand("cmd_InsertCellAfter",    nsInsertTableCellAfterCommand);
-  commandTable.registerCommand("cmd_DeleteTable",        nsDeleteTableCommand);
-  commandTable.registerCommand("cmd_DeleteRow",          nsDeleteTableRowCommand);
-  commandTable.registerCommand("cmd_DeleteColumn",       nsDeleteTableColumnCommand);
-  commandTable.registerCommand("cmd_DeleteCell",         nsDeleteTableCellCommand);
+  commandTable.registerCommand("cmd_InsertColumnAfter", nsInsertTableColumnAfterCommand);
+  commandTable.registerCommand("cmd_InsertCellBefore", nsInsertTableCellBeforeCommand);
+  commandTable.registerCommand("cmd_InsertCellAfter", nsInsertTableCellAfterCommand);
+  commandTable.registerCommand("cmd_DeleteTable", nsDeleteTableCommand);
+  commandTable.registerCommand("cmd_DeleteRow", nsDeleteTableRowCommand);
+  commandTable.registerCommand("cmd_DeleteColumn", nsDeleteTableColumnCommand);
+  commandTable.registerCommand("cmd_DeleteCell", nsDeleteTableCellCommand);
   commandTable.registerCommand("cmd_DeleteCellContents", nsDeleteTableCellContentsCommand);
-  commandTable.registerCommand("cmd_JoinTableCells",     nsJoinTableCellsCommand);
-  commandTable.registerCommand("cmd_SplitTableCell",     nsSplitTableCellCommand);
-  commandTable.registerCommand("cmd_TableOrCellColor",   nsTableOrCellColorCommand);
-  commandTable.registerCommand("cmd_NormalizeTable",     nsNormalizeTableCommand);
-  commandTable.registerCommand("cmd_smiley",             nsSetSmiley);
-  commandTable.registerCommand("cmd_ConvertToTable",     nsConvertToTable);
+  commandTable.registerCommand("cmd_JoinTableCells", nsJoinTableCellsCommand);
+  commandTable.registerCommand("cmd_SplitTableCell", nsSplitTableCellCommand);
+  commandTable.registerCommand("cmd_TableOrCellColor", nsTableOrCellColorCommand);
+  commandTable.registerCommand("cmd_NormalizeTable", nsNormalizeTableCommand);
+  commandTable.registerCommand("cmd_smiley", nsSetSmiley);
+  commandTable.registerCommand("cmd_ConvertToTable", nsConvertToTable);
 }
 
-function SetupTextEditorCommands()
-{
+function SetupTextEditorCommands() {
   var commandTable = GetComposerCommandTable();
   if (!commandTable)
     return;
 
-  //dump("Registering plain text editor commands\n");
-
-  commandTable.registerCommand("cmd_findReplace",nsFindReplaceCommand);
-  commandTable.registerCommand("cmd_find",       nsFindCommand);
-  commandTable.registerCommand("cmd_findNext",   nsFindAgainCommand);
-  commandTable.registerCommand("cmd_findPrev",   nsFindAgainCommand);
-  commandTable.registerCommand("cmd_rewrap",     nsRewrapCommand);
-  commandTable.registerCommand("cmd_spelling",   nsSpellingCommand);
-  commandTable.registerCommand("cmd_validate",   nsValidateCommand);
+  // dump("Registering plain text editor commands\n");
+
+  commandTable.registerCommand("cmd_findReplace", nsFindReplaceCommand);
+  commandTable.registerCommand("cmd_find", nsFindCommand);
+  commandTable.registerCommand("cmd_findNext", nsFindAgainCommand);
+  commandTable.registerCommand("cmd_findPrev", nsFindAgainCommand);
+  commandTable.registerCommand("cmd_rewrap", nsRewrapCommand);
+  commandTable.registerCommand("cmd_spelling", nsSpellingCommand);
+  commandTable.registerCommand("cmd_validate", nsValidateCommand);
   commandTable.registerCommand("cmd_checkLinks", nsCheckLinksCommand);
   commandTable.registerCommand("cmd_insertChars", nsInsertCharsCommand);
 }
 
-function SetupComposerWindowCommands()
-{
+function SetupComposerWindowCommands() {
   // Don't need to do this if already done
   if (gComposerWindowControllerID)
     return;
 
   // Create a command controller and register commands
   //   specific to Web Composer window (file-related commands, HTML Source...)
   //   We can't use the composer controller created on the content window else
   //     we can't process commands when in HTMLSource editor
@@ -122,114 +119,103 @@ function SetupComposerWindowCommands()
   try {
     composerController = Cc["@mozilla.org/embedcomp/base-command-controller;1"].createInstance();
 
     editorController = composerController.QueryInterface(Ci.nsIControllerContext);
 
     // Get the nsIControllerCommandTable interface we need to register commands
     var interfaceRequestor = composerController.QueryInterface(Ci.nsIInterfaceRequestor);
     commandTable = interfaceRequestor.getInterface(Ci.nsIControllerCommandTable);
-  }
-  catch (e)
-  {
+  } catch (e) {
     dump("Failed to create composerController\n");
     return;
   }
 
 
-  if (!commandTable)
-  {
+  if (!commandTable) {
     dump("Failed to get interface for nsIControllerCommandManager\n");
     return;
   }
 
   // File-related commands
-  commandTable.registerCommand("cmd_open",           nsOpenCommand);
-  commandTable.registerCommand("cmd_save",           nsSaveCommand);
-  commandTable.registerCommand("cmd_saveAs",         nsSaveAsCommand);
-  commandTable.registerCommand("cmd_exportToText",   nsExportToTextCommand);
-  commandTable.registerCommand("cmd_saveAndChangeEncoding",  nsSaveAndChangeEncodingCommand);
-  commandTable.registerCommand("cmd_publish",        nsPublishCommand);
-  commandTable.registerCommand("cmd_publishAs",      nsPublishAsCommand);
-  commandTable.registerCommand("cmd_publishSettings",nsPublishSettingsCommand);
-  commandTable.registerCommand("cmd_revert",         nsRevertCommand);
-  commandTable.registerCommand("cmd_openRemote",     nsOpenRemoteCommand);
-  commandTable.registerCommand("cmd_preview",        nsPreviewCommand);
-  commandTable.registerCommand("cmd_editSendPage",   nsSendPageCommand);
-  commandTable.registerCommand("cmd_print",          nsPrintCommand);
-  commandTable.registerCommand("cmd_printpreview",   nsPrintPreviewCommand);
-  commandTable.registerCommand("cmd_printSetup",     nsPrintSetupCommand);
-  commandTable.registerCommand("cmd_close",          nsCloseCommand);
-  commandTable.registerCommand("cmd_preferences",    nsPreferencesCommand);
+  commandTable.registerCommand("cmd_open", nsOpenCommand);
+  commandTable.registerCommand("cmd_save", nsSaveCommand);
+  commandTable.registerCommand("cmd_saveAs", nsSaveAsCommand);
+  commandTable.registerCommand("cmd_exportToText", nsExportToTextCommand);
+  commandTable.registerCommand("cmd_saveAndChangeEncoding", nsSaveAndChangeEncodingCommand);
+  commandTable.registerCommand("cmd_publish", nsPublishCommand);
+  commandTable.registerCommand("cmd_publishAs", nsPublishAsCommand);
+  commandTable.registerCommand("cmd_publishSettings", nsPublishSettingsCommand);
+  commandTable.registerCommand("cmd_revert", nsRevertCommand);
+  commandTable.registerCommand("cmd_openRemote", nsOpenRemoteCommand);
+  commandTable.registerCommand("cmd_preview", nsPreviewCommand);
+  commandTable.registerCommand("cmd_editSendPage", nsSendPageCommand);
+  commandTable.registerCommand("cmd_print", nsPrintCommand);
+  commandTable.registerCommand("cmd_printpreview", nsPrintPreviewCommand);
+  commandTable.registerCommand("cmd_printSetup", nsPrintSetupCommand);
+  commandTable.registerCommand("cmd_close", nsCloseCommand);
+  commandTable.registerCommand("cmd_preferences", nsPreferencesCommand);
 
   // Edit Mode commands
-  if (GetCurrentEditorType() == "html")
-  {
-    commandTable.registerCommand("cmd_NormalMode",         nsNormalModeCommand);
-    commandTable.registerCommand("cmd_AllTagsMode",        nsAllTagsModeCommand);
-    commandTable.registerCommand("cmd_HTMLSourceMode",     nsHTMLSourceModeCommand);
-    commandTable.registerCommand("cmd_PreviewMode",        nsPreviewModeCommand);
-    commandTable.registerCommand("cmd_FinishHTMLSource",   nsFinishHTMLSource);
-    commandTable.registerCommand("cmd_CancelHTMLSource",   nsCancelHTMLSource);
+  if (GetCurrentEditorType() == "html") {
+    commandTable.registerCommand("cmd_NormalMode", nsNormalModeCommand);
+    commandTable.registerCommand("cmd_AllTagsMode", nsAllTagsModeCommand);
+    commandTable.registerCommand("cmd_HTMLSourceMode", nsHTMLSourceModeCommand);
+    commandTable.registerCommand("cmd_PreviewMode", nsPreviewModeCommand);
+    commandTable.registerCommand("cmd_FinishHTMLSource", nsFinishHTMLSource);
+    commandTable.registerCommand("cmd_CancelHTMLSource", nsCancelHTMLSource);
     commandTable.registerCommand("cmd_updateStructToolbar", nsUpdateStructToolbarCommand);
   }
 
   windowControllers.insertControllerAt(0, editorController);
 
   // Store the controller ID so we can be sure to get the right one later
   gComposerWindowControllerID = windowControllers.getControllerId(editorController);
 }
 
-//-----------------------------------------------------------------------------------
-function GetComposerCommandTable()
-{
+// -----------------------------------------------------------------------------------
+function GetComposerCommandTable() {
   var controller;
-  if (gComposerJSCommandControllerID)
-  {
+  if (gComposerJSCommandControllerID) {
     try {
       controller = window.content.controllers.getControllerById(gComposerJSCommandControllerID);
     } catch (e) {}
   }
-  if (!controller)
-  {
-    //create it
+  if (!controller) {
+    // create it
     controller = Cc["@mozilla.org/embedcomp/base-command-controller;1"].createInstance();
 
     var editorController = controller.QueryInterface(Ci.nsIControllerContext);
     editorController.setCommandContext(GetCurrentEditorElement());
     window.content.controllers.insertControllerAt(0, controller);
 
     // Store the controller ID so we can be sure to get the right one later
     gComposerJSCommandControllerID = window.content.controllers.getControllerId(controller);
   }
 
-  if (controller)
-  {
+  if (controller) {
     var interfaceRequestor = controller.QueryInterface(Ci.nsIInterfaceRequestor);
     return interfaceRequestor.getInterface(Ci.nsIControllerCommandTable);
   }
   return null;
 }
 
-//-----------------------------------------------------------------------------------
-function goUpdateCommandState(command)
-{
-  try
-  {
+// -----------------------------------------------------------------------------------
+function goUpdateCommandState(command) {
+  try {
     var controller = top.document.commandDispatcher.getControllerForCommand(command);
     if (!(controller instanceof Ci.nsICommandController))
       return;
 
     var params = newCommandParams();
     if (!params) return;
 
     controller.getCommandStateWithParams(command, params);
 
-    switch (command)
-    {
+    switch (command) {
       case "cmd_bold":
       case "cmd_italic":
       case "cmd_underline":
       case "cmd_var":
       case "cmd_samp":
       case "cmd_code":
       case "cmd_acronym":
       case "cmd_abbr":
@@ -264,109 +250,91 @@ function goUpdateCommandState(command)
       case "cmd_increaseFont":
       case "cmd_decreaseFont":
       case "cmd_increaseFontStep":
       case "cmd_decreaseFontStep":
       case "cmd_removeStyles":
       case "cmd_smiley":
         break;
 
-      default: dump("no update for command: " +command+"\n");
+      default: dump("no update for command: " + command + "\n");
     }
-  }
-  catch (e) { dump("An error occurred updating the "+command+" command: \n"+e+"\n"); }
+  } catch (e) { dump("An error occurred updating the " + command + " command: \n" + e + "\n"); }
 }
 
-function goUpdateComposerMenuItems(commandset)
-{
-  //dump("Updating commands for " + commandset.id + "\n");
-
-  for (var i = 0; i < commandset.childNodes.length; i++)
-  {
+function goUpdateComposerMenuItems(commandset) {
+  // dump("Updating commands for " + commandset.id + "\n");
+
+  for (var i = 0; i < commandset.childNodes.length; i++) {
     var commandNode = commandset.childNodes[i];
     var commandID = commandNode.id;
-    if (commandID)
-    {
+    if (commandID) {
       goUpdateCommand(commandID);  // enable or disable
       if (commandNode.hasAttribute("state"))
         goUpdateCommandState(commandID);
     }
   }
 }
 
-//-----------------------------------------------------------------------------------
-function goDoCommandParams(command, params)
-{
-  try
-  {
+// -----------------------------------------------------------------------------------
+function goDoCommandParams(command, params) {
+  try {
     var controller = top.document.commandDispatcher.getControllerForCommand(command);
-    if (controller && controller.isCommandEnabled(command))
-    {
-      if (controller instanceof Ci.nsICommandController)
-      {
+    if (controller && controller.isCommandEnabled(command)) {
+      if (controller instanceof Ci.nsICommandController) {
         controller.doCommandWithParams(command, params);
 
         // the following two lines should be removed when we implement observers
         if (params)
           controller.getCommandStateWithParams(command, params);
-      }
-      else
-      {
+      } else {
         controller.doCommand(command);
       }
       ResetStructToolbar();
     }
-  }
-  catch (e)
-  {
-    dump("An error occurred executing the "+command+" command\n");
+  } catch (e) {
+    dump("An error occurred executing the " + command + " command\n");
   }
 }
 
-function pokeStyleUI(uiID, aDesiredState)
-{
+function pokeStyleUI(uiID, aDesiredState) {
  try {
   var commandNode = top.document.getElementById(uiID);
   if (!commandNode)
     return;
 
   var uiState = ("true" == commandNode.getAttribute("state"));
-  if (aDesiredState != uiState)
-  {
+  if (aDesiredState != uiState) {
     commandNode.setAttribute("state", aDesiredState ? "true" : "false");
   }
- } catch(e) { dump("poking UI for "+uiID+" failed: "+e+"\n"); }
+ } catch (e) { dump("poking UI for " + uiID + " failed: " + e + "\n"); }
 }
 
-function doStyleUICommand(cmdStr)
-{
-  try
-  {
+function doStyleUICommand(cmdStr) {
+  try {
     var cmdParams = newCommandParams();
     goDoCommandParams(cmdStr, cmdParams);
     if (cmdParams)
       pokeStyleUI(cmdStr, cmdParams.getBooleanValue("state_all"));
 
     ResetStructToolbar();
-  } catch(e) {}
+  } catch (e) {}
 }
 
 // Copied from jsmime.js.
 function stringToTypedArray(buffer) {
   var typedarray = new Uint8Array(buffer.length);
   for (var i = 0; i < buffer.length; i++) {
     typedarray[i] = buffer.charCodeAt(i);
   }
   return typedarray;
 }
 
-function pokeMultiStateUI(uiID, cmdParams)
-{
-  try
-  {
+function pokeMultiStateUI(uiID, cmdParams) {
+  try {
     var commandNode = document.getElementById(uiID);
     if (!commandNode)
       return;
 
     var isMixed = cmdParams.getBooleanValue("state_mixed");
     var desiredAttrib;
     if (isMixed)
       desiredAttrib = "mixed";
@@ -374,104 +342,93 @@ function pokeMultiStateUI(uiID, cmdParam
       var valuetype = cmdParams.getValueType("state_attribute");
       if (valuetype == Ci.nsICommandParams.eStringType) {
         desiredAttrib = cmdParams.getCStringValue("state_attribute");
         // Decode UTF-8, for example for font names in Japanese.
         desiredAttrib = new TextDecoder("UTF-8").decode(stringToTypedArray(desiredAttrib));
       } else {
         desiredAttrib = cmdParams.getStringValue("state_attribute");
       }
-
     }
 
     var uiState = commandNode.getAttribute("state");
-    if (desiredAttrib != uiState)
-    {
+    if (desiredAttrib != uiState) {
       commandNode.setAttribute("state", desiredAttrib);
     }
-  } catch(e) {}
+  } catch (e) {}
 }
 
-function doStatefulCommand(commandID, newState)
-{
+function doStatefulCommand(commandID, newState) {
   var commandNode = document.getElementById(commandID);
   if (commandNode)
       commandNode.setAttribute("state", newState);
   gContentWindow.focus();   // needed for command dispatch to work
 
-  try
-  {
+  try {
     var cmdParams = newCommandParams();
     if (!cmdParams) return;
 
     cmdParams.setStringValue("state_attribute", newState);
     goDoCommandParams(commandID, cmdParams);
 
     pokeMultiStateUI(commandID, cmdParams);
 
     ResetStructToolbar();
-  } catch(e) { dump("error thrown in doStatefulCommand: "+e+"\n"); }
+  } catch (e) { dump("error thrown in doStatefulCommand: " + e + "\n"); }
 }
 
-//-----------------------------------------------------------------------------------
-function PrintObject(obj)
-{
+// -----------------------------------------------------------------------------------
+function PrintObject(obj) {
   dump("-----" + obj + "------\n");
   var names = "";
-  for (var i in obj)
-  {
+  for (var i in obj) {
     if (i == "value")
       names += i + ": " + obj.value + "\n";
     else if (i == "id")
       names += i + ": " + obj.id + "\n";
     else
       names += i + "\n";
   }
 
   dump(names + "-----------\n");
 }
 
-//-----------------------------------------------------------------------------------
-function PrintNodeID(id)
-{
+// -----------------------------------------------------------------------------------
+function PrintNodeID(id) {
   PrintObject(document.getElementById(id));
 }
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsDummyHTMLCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // do nothing
     dump("Hey, who's calling the dummy command?\n");
-  }
+  },
 
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsOpenCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return true;    // we can always do this
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     var fileType = IsHTMLEditor() ? "html" : "text";
     var title = GetString(IsHTMLEditor() ? "OpenHTMLFile" : "OpenTextFile");
 
     var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
     fp.init(window, title, nsIFilePicker.modeOpen);
 
     SetFilePickerDirectory(fp, fileType);
 
@@ -488,297 +445,266 @@ var nsOpenCommand =
         return;
       }
       // editPage checks for already open window and activates it.
       if (fp.fileURL.spec) {
         SaveFilePickerDirectory(fp, fileType);
         editPage(fp.fileURL.spec, fileType);
       }
     });
-  }
+  },
 };
 
 // STRUCTURE TOOLBAR
 //
 var nsUpdateStructToolbarCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     UpdateStructToolbar();
     return true;
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-  doCommand: function(aCommand)  {}
-}
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+  doCommand(aCommand) {},
+};
 
 // ******* File output commands and utilities ******** //
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsSaveCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     // Always allow saving when editing a remote document,
     //  otherwise the document modified state would prevent that
     //  when you first open a remote file.
     try {
       var docUrl = GetDocumentUrl();
       return IsDocumentEditable() &&
         (IsDocumentModified() || IsHTMLSourceChanged() ||
          IsUrlAboutBlank(docUrl) || GetScheme(docUrl) != "file");
-    } catch (e) {return false;}
+    } catch (e) { return false; }
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     var editor = GetCurrentEditor();
-    if (editor)
-    {
+    if (editor) {
       if (IsHTMLEditor())
         SetEditMode(gPreviousNonSourceDisplayMode);
       SaveDocument(IsUrlAboutBlank(GetDocumentUrl()), false, editor.contentsMIMEType);
     }
-  }
-}
+  },
+};
 
 var nsSaveAsCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     var editor = GetCurrentEditor();
-    if (editor)
-    {
+    if (editor) {
       if (IsHTMLEditor())
         SetEditMode(gPreviousNonSourceDisplayMode);
       SaveDocument(true, false, editor.contentsMIMEType);
     }
-  }
-}
+  },
+};
 
 var nsExportToTextCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    if (GetCurrentEditor())
-    {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    if (GetCurrentEditor()) {
       SetEditMode(gPreviousNonSourceDisplayMode);
       SaveDocument(true, true, "text/plain");
     }
-  }
-}
+  },
+};
 
 var nsSaveAndChangeEncodingCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     SetEditMode(gPreviousNonSourceDisplayMode);
     window.ok = false;
     window.exportToText = false;
     var oldTitle = GetDocumentTitle();
-    window.openDialog("chrome://editor/content/EditorSaveAsCharset.xul","_blank", "chrome,close,titlebar,modal,resizable=yes");
+    window.openDialog("chrome://editor/content/EditorSaveAsCharset.xul", "_blank", "chrome,close,titlebar,modal,resizable=yes");
 
     if (GetDocumentTitle() != oldTitle)
       UpdateWindowTitle();
 
-    if (window.ok)
-    {
-      if (window.exportToText)
-      {
+    if (window.ok) {
+      if (window.exportToText) {
         SaveDocument(true, true, "text/plain");
-      }
-      else
-      {
+      } else {
         var editor = GetCurrentEditor();
         SaveDocument(true, false, editor ? editor.contentsMIMEType : null);
       }
     }
-  }
+  },
 };
 
 var nsPublishCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
-    if (IsDocumentEditable())
-    {
+  isCommandEnabled(aCommand, dummy) {
+    if (IsDocumentEditable()) {
       // Always allow publishing when editing a local document,
       //  otherwise the document modified state would prevent that
       //  when you first open any local file.
       try {
         var docUrl = GetDocumentUrl();
         return IsDocumentModified() || IsHTMLSourceChanged()
                || IsUrlAboutBlank(docUrl) || GetScheme(docUrl) == "file";
-      } catch (e) {return false;}
+      } catch (e) { return false; }
     }
     return false;
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    if (GetCurrentEditor())
-    {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    if (GetCurrentEditor()) {
       let docUrl = GetDocumentUrl();
       let filename = GetFilename(docUrl);
       let publishData;
 
       // First check pref to always show publish dialog
       let showPublishDialog = Services.prefs.getBoolPref("editor.always_show_publish_dialog");
 
-      if (!showPublishDialog && filename)
-      {
+      if (!showPublishDialog && filename) {
         // Try to get publish data from the document url
         publishData = CreatePublishDataFromUrl(docUrl);
 
         // If none, use default publishing site? Need a pref for this
-        //if (!publishData)
+        // if (!publishData)
         //  publishData = GetPublishDataFromSiteName(GetDefaultPublishSiteName(), filename);
       }
 
-      if (showPublishDialog || !publishData)
-      {
+      if (showPublishDialog || !publishData) {
         // Show the publish dialog
         publishData = {};
         window.ok = false;
         let oldTitle = GetDocumentTitle();
-        window.openDialog("chrome://editor/content/EditorPublish.xul","_blank",
+        window.openDialog("chrome://editor/content/EditorPublish.xul", "_blank",
                           "chrome,close,titlebar,modal", "", "", publishData);
         if (GetDocumentTitle() != oldTitle)
           UpdateWindowTitle();
 
         if (!window.ok)
           return false;
       }
-      if (publishData)
-      {
+      if (publishData) {
         SetEditMode(gPreviousNonSourceDisplayMode);
         return Publish(publishData);
       }
     }
     return false;
-  }
-}
+  },
+};
 
 var nsPublishAsCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    if (GetCurrentEditor())
-    {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    if (GetCurrentEditor()) {
       SetEditMode(gPreviousNonSourceDisplayMode);
 
       window.ok = false;
       var publishData = {};
       var oldTitle = GetDocumentTitle();
-      window.openDialog("chrome://editor/content/EditorPublish.xul","_blank",
+      window.openDialog("chrome://editor/content/EditorPublish.xul", "_blank",
                         "chrome,close,titlebar,modal", "", "", publishData);
       if (GetDocumentTitle() != oldTitle)
         UpdateWindowTitle();
 
       if (window.ok)
         return Publish(publishData);
     }
     return false;
-  }
-}
+  },
+};
 
 // ------- output utilities   ----- //
 
 // returns a fileExtension string
-function GetExtensionBasedOnMimeType(aMIMEType)
-{
+function GetExtensionBasedOnMimeType(aMIMEType) {
   try {
     var mimeService = null;
     mimeService = Cc["@mozilla.org/mime;1"]
                     .getService(Ci.nsIMIMEService);
 
     var fileExtension = mimeService.getPrimaryExtension(aMIMEType, null);
 
     // the MIME service likes to give back ".htm" for text/html files,
     // so do a special-case fix here.
     if (fileExtension == "htm")
       fileExtension = "html";
 
     return fileExtension;
-  }
-  catch (e) {}
+  } catch (e) {}
   return "";
 }
 
-function GetSuggestedFileName(aDocumentURLString, aMIMEType)
-{
+function GetSuggestedFileName(aDocumentURLString, aMIMEType) {
   var extension = GetExtensionBasedOnMimeType(aMIMEType);
   if (extension)
     extension = "." + extension;
 
   // check for existing file name we can use
-  if (aDocumentURLString && !IsUrlAboutBlank(aDocumentURLString))
-  {
+  if (aDocumentURLString && !IsUrlAboutBlank(aDocumentURLString)) {
     try {
       let docURI = Services.io.newURI(aDocumentURLString,
         GetCurrentEditor().documentCharacterSet);
       docURI = docURI.QueryInterface(Ci.nsIURL);
 
       // grab the file name
       let url = validateFileName(decodeURIComponent(docURI.fileBaseName));
       if (url)
         return url + extension;
-    } catch(e) {}
+    } catch (e) {}
   }
 
   // Check if there is a title we can use to generate a valid filename,
   // if we can't, use the default filename.
   var title = validateFileName(GetDocumentTitle()) ||
               GetString("untitledDefaultFilename");
   return title + extension;
 }
 
 /**
  * @return {Promise} dialogResult
  */
-function PromptForSaveLocation(aDoSaveAsText, aEditorType, aMIMEType, aDocumentURLString)
-{
+function PromptForSaveLocation(aDoSaveAsText, aEditorType, aMIMEType, aDocumentURLString) {
   var dialogResult = {};
   dialogResult.filepickerClick = nsIFilePicker.returnCancel;
   dialogResult.resultingURI = "";
   dialogResult.resultingLocalFile = null;
 
   var fp = null;
   try {
     fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
@@ -810,74 +736,66 @@ function PromptForSaveLocation(aDoSaveAs
   // assuming we have information needed (like prior saved location)
   try {
     var fileHandler = GetFileProtocolHandler();
 
     var isLocalFile = true;
     try {
       let docURI = Services.io.newURI(aDocumentURLString, GetCurrentEditor().documentCharacterSet);
       isLocalFile = docURI.schemeIs("file");
-    }
-    catch (e) {}
+    } catch (e) {}
 
     var parentLocation = null;
-    if (isLocalFile)
-    {
+    if (isLocalFile) {
       var fileLocation = fileHandler.getFileFromURLSpec(aDocumentURLString); // this asserts if url is not local
       parentLocation = fileLocation.parent;
     }
-    if (parentLocation)
-    {
+    if (parentLocation) {
       // Save current filepicker's default location
       if ("gFilePickerDirectory" in window)
         gFilePickerDirectory = fp.displayDirectory;
 
       fp.displayDirectory = parentLocation;
-    }
-    else
-    {
+    } else {
       // Initialize to the last-used directory for the particular type (saved in prefs)
       SetFilePickerDirectory(fp, aEditorType);
     }
-  }
-  catch(e) {}
+  } catch (e) {}
 
   return new Promise(resolve => {
     fp.open(rv => {
       dialogResult.filepickerClick = rv;
       if (rv != nsIFilePicker.returnCancel && fp.file) {  // Allow OK and replace.
         // reset urlstring to new save location
         dialogResult.resultingURIString = fileHandler.getURLSpecFromFile(fp.file);
         dialogResult.resultingLocalFile = fp.file;
         SaveFilePickerDirectory(fp, aEditorType);
         resolve(dialogResult);
-      }
-      else if ("gFilePickerDirectory" in window && gFilePickerDirectory) {
+      } else if ("gFilePickerDirectory" in window && gFilePickerDirectory) {
         fp.displayDirectory = gFilePickerDirectory;
         resolve(null);
       }
     });
   });
 }
 
 /**
  * If needed, prompt for document title and set the document title to the
  * preferred value.
  * @return true if the title was set up successfully;
  *         false if the user cancelled the title prompt
  */
-function PromptAndSetTitleIfNone()
-{
+function PromptAndSetTitleIfNone() {
   if (GetDocumentTitle()) // we have a title; no need to prompt!
     return true;
 
-  let result = {value:null};
+  let result = {value: null};
   let captionStr = GetString("DocumentTitle");
-  let msgStr = GetString("NeedDocTitle") + '\n' + GetString("DocTitleHelp");
-  let confirmed = Services.prompt.prompt(window, captionStr, msgStr, result, null, {value:0});
+  let msgStr = GetString("NeedDocTitle") + "\n" + GetString("DocTitleHelp");
+  let confirmed = Services.prompt.prompt(window, captionStr, msgStr, result, null, {value: 0});
   if (confirmed)
     SetDocumentTitle(TrimString(result.value));
 
   return confirmed;
 }
 
 var gPersistObj;
 
@@ -886,35 +804,32 @@ var gPersistObj;
 //    if (doUpdateURI)
 //      SetDocumentURI(docURI);
 //    UpdateWindowTitle();
 //    if (!aSaveCopy)
 //      editor.resetModificationCount();
       // this should cause notification to listeners that document has changed
 
 const webPersist = Ci.nsIWebBrowserPersist;
-function OutputFileWithPersistAPI(editorDoc, aDestinationLocation, aRelatedFilesParentDir, aMimeType)
-{
+function OutputFileWithPersistAPI(editorDoc, aDestinationLocation, aRelatedFilesParentDir, aMimeType) {
   gPersistObj = null;
   var editor = GetCurrentEditor();
   try {
     editor.forceCompositionEnd();
   } catch (e) {}
 
   var isLocalFile = false;
   try {
     var tmp1 = aDestinationLocation.QueryInterface(Ci.nsIFile);
     isLocalFile = true;
-  }
-  catch (e) {
+  } catch (e) {
     try {
       var tmp = aDestinationLocation.QueryInterface(Ci.nsIURI);
       isLocalFile = tmp.schemeIs("file");
-    }
-    catch (e) {}
+    } catch (e) {}
   }
 
   try {
     // we should supply a parent directory if/when we turn on functionality to save related documents
     var persistObj = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(webPersist);
     persistObj.progressListener = gEditorOutputProgressListener;
 
     var wrapColumn = GetWrapColumn();
@@ -939,64 +854,57 @@ function OutputFileWithPersistAPI(editor
                             | webPersist.PERSIST_FLAGS_NO_BASE_TAG_MODIFICATIONS
                             | webPersist.PERSIST_FLAGS_REPLACE_EXISTING_FILES
                             | webPersist.PERSIST_FLAGS_DONT_FIXUP_LINKS
                             | webPersist.PERSIST_FLAGS_DONT_CHANGE_FILENAMES
                             | webPersist.PERSIST_FLAGS_FIXUP_ORIGINAL_DOM;
     persistObj.saveDocument(editorDoc, aDestinationLocation, aRelatedFilesParentDir,
                             aMimeType, outputFlags, wrapColumn);
     gPersistObj = persistObj;
-  }
-  catch(e) { dump("caught an error, bail\n"); return false; }
+  } catch (e) { dump("caught an error, bail\n"); return false; }
 
   return true;
 }
 
 // returns output flags based on mimetype, wrapCol and prefs
-function GetOutputFlags(aMimeType, aWrapColumn)
-{
+function GetOutputFlags(aMimeType, aWrapColumn) {
   var outputFlags = 0;
   var editor = GetCurrentEditor();
   var outputEntity = (editor && editor.documentCharacterSet == "ISO-8859-1")
     ? webPersist.ENCODE_FLAGS_ENCODE_LATIN1_ENTITIES
     : webPersist.ENCODE_FLAGS_ENCODE_BASIC_ENTITIES;
-  if (aMimeType == "text/plain")
-  {
+  if (aMimeType == "text/plain") {
     // When saving in "text/plain" format, always do formatting
     outputFlags |= webPersist.ENCODE_FLAGS_FORMATTED;
-  }
-  else
-  {
+  } else {
     // Should we prettyprint? Check the pref
     if (Services.prefs.getBoolPref("editor.prettyprint"))
       outputFlags |= webPersist.ENCODE_FLAGS_FORMATTED;
 
     try {
       // How much entity names should we output? Check the pref
       switch (Services.prefs.getCharPref("editor.encode_entity")) {
-        case "basic"  : outputEntity = webPersist.ENCODE_FLAGS_ENCODE_BASIC_ENTITIES; break;
+        case "basic" : outputEntity = webPersist.ENCODE_FLAGS_ENCODE_BASIC_ENTITIES; break;
         case "latin1" : outputEntity = webPersist.ENCODE_FLAGS_ENCODE_LATIN1_ENTITIES; break;
-        case "html"   : outputEntity = webPersist.ENCODE_FLAGS_ENCODE_HTML_ENTITIES; break;
-        case "none"   : outputEntity = 0; break;
+        case "html" : outputEntity = webPersist.ENCODE_FLAGS_ENCODE_HTML_ENTITIES; break;
+        case "none" : outputEntity = 0; break;
       }
-    }
-    catch (e) {}
+    } catch (e) {}
   }
   outputFlags |= outputEntity;
 
   if (aWrapColumn > 0)
     outputFlags |= webPersist.ENCODE_FLAGS_WRAP;
 
   return outputFlags;
 }
 
 // returns number of column where to wrap
 const nsIWebBrowserPersist = Ci.nsIWebBrowserPersist;
-function GetWrapColumn()
-{
+function GetWrapColumn() {
   try {
     return GetCurrentEditor().wrapWidth;
   } catch (e) {}
   return 0;
 }
 
 const gShowDebugOutputStateChange = false;
 const gShowDebugOutputProgress = false;
@@ -1009,330 +917,291 @@ const nsIWebProgressListener = Ci.nsIWeb
 const nsIChannel = Ci.nsIChannel;
 
 const kErrorBindingAborted = 2152398850;
 const kErrorBindingRedirected = 2152398851;
 const kFileNotFound = 2152857618;
 
 var gEditorOutputProgressListener =
 {
-  onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
-  {
+  onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
     var editor = GetCurrentEditor();
 
     // Use this to access onStateChange flags
     var requestSpec;
     try {
       var channel = aRequest.QueryInterface(nsIChannel);
       requestSpec = StripUsernamePasswordFromURI(channel.URI);
     } catch (e) {
       if (gShowDebugOutputStateChange)
         dump("***** onStateChange; NO REQUEST CHANNEL\n");
     }
 
     var pubSpec;
     if (gPublishData)
       pubSpec = gPublishData.publishUrl + gPublishData.docDir + gPublishData.filename;
 
-    if (gShowDebugOutputStateChange)
-    {
+    if (gShowDebugOutputStateChange) {
       dump("\n***** onStateChange request: " + requestSpec + "\n");
       dump("      state flags: ");
 
       if (aStateFlags & nsIWebProgressListener.STATE_START)
         dump(" STATE_START, ");
       if (aStateFlags & nsIWebProgressListener.STATE_STOP)
         dump(" STATE_STOP, ");
       if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK)
         dump(" STATE_IS_NETWORK ");
 
-      dump("\n * requestSpec="+requestSpec+", pubSpec="+pubSpec+", aStatus="+aStatus+"\n");
+      dump("\n * requestSpec=" + requestSpec + ", pubSpec=" + pubSpec + ", aStatus=" + aStatus + "\n");
 
       DumpDebugStatus(aStatus);
     }
     // The rest only concerns publishing, so bail out if no dialog
     if (!gProgressDialog)
       return;
 
     // Detect start of file upload of any file:
     // (We ignore any START messages after gPersistObj says publishing is finished
     if ((aStateFlags & nsIWebProgressListener.STATE_START)
          && gPersistObj && requestSpec
-         && (gPersistObj.currentState != gPersistObj.PERSIST_STATE_FINISHED))
-    {
+         && (gPersistObj.currentState != gPersistObj.PERSIST_STATE_FINISHED)) {
       try {
         // Add url to progress dialog's list showing each file uploading
         gProgressDialog.SetProgressStatus(GetFilename(requestSpec), "busy");
-      } catch(e) {}
+      } catch (e) {}
     }
 
     // Detect end of file upload of any file:
-    if (aStateFlags & nsIWebProgressListener.STATE_STOP)
-    {
+    if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
       // ignore aStatus == kErrorBindingAborted; check http response for possible errors
       try {
         // check http channel for response: 200 range is ok; other ranges are not
         var httpChannel = aRequest.QueryInterface(Ci.nsIHttpChannel);
         var httpResponse = httpChannel.responseStatus;
         if (httpResponse < 200 || httpResponse >= 300)
           aStatus = httpResponse;   // not a real error but enough to pass check below
         else if (aStatus == kErrorBindingAborted)
           aStatus = 0;
 
         if (gShowDebugOutputStateChange)
-          dump("http response is: "+httpResponse+"\n");
-      }
-      catch(e)
-      {
+          dump("http response is: " + httpResponse + "\n");
+      } catch (e) {
         if (aStatus == kErrorBindingAborted)
           aStatus = 0;
       }
 
       // We abort publishing for all errors except if image src file is not found
       var abortPublishing = (aStatus != 0 && aStatus != kFileNotFound);
 
       // Notify progress dialog when we receive the STOP
       //  notification for a file if there was an error
       //  or a successful finish
       //  (Check requestSpec to be sure message is for destination url)
       if (aStatus != 0
-           || (requestSpec && requestSpec.startsWith(GetScheme(gPublishData.publishUrl))))
-      {
+           || (requestSpec && requestSpec.startsWith(GetScheme(gPublishData.publishUrl)))) {
         try {
           gProgressDialog.SetProgressFinished(GetFilename(requestSpec), aStatus);
-        } catch(e) {}
+        } catch (e) {}
       }
 
 
-      if (abortPublishing)
-      {
+      if (abortPublishing) {
         // Cancel publishing
         gPersistObj.cancelSave();
 
         // Don't do any commands after failure
         gCommandAfterPublishing = null;
 
         // Restore original document to undo image src url adjustments
-        if (gRestoreDocumentSource)
-        {
+        if (gRestoreDocumentSource) {
           try {
             editor.rebuildDocumentFromSource(gRestoreDocumentSource);
 
             // Clear transaction cache since we just did a potentially
             //  very large insert and this will eat up memory
             editor.transactionManager.clear();
-          }
-          catch (e) {}
+          } catch (e) {}
         }
 
         // Notify progress dialog that we're finished
         //  and keep open to show error
         gProgressDialog.SetProgressFinished(null, 0);
 
         // We don't want to change location or reset mod count, etc.
         return;
       }
 
-      //XXX HACK: "file://" protocol is not supported in network code
+      // XXX HACK: "file://" protocol is not supported in network code
       //    (bug 151867 filed to add this support, bug 151869 filed
       //     to remove this and other code in nsIWebBrowserPersist)
       //    nsIWebBrowserPersist *does* copy the file(s), but we don't
       //    get normal onStateChange messages.
 
       // Case 1: If images are included, we get fairly normal
       //    STATE_START/STATE_STOP & STATE_IS_NETWORK messages associated with the image files,
       //    thus we must finish HTML file progress below
 
       // Case 2: If just HTML file is uploaded, we get STATE_START and STATE_STOP
       //    notification with a null "requestSpec", and
       //    the gPersistObj is destroyed before we get here!
       //    So create an new object so we can flow through normal processing below
       if (!requestSpec && GetScheme(gPublishData.publishUrl) == "file"
-          && (!gPersistObj || gPersistObj.currentState == nsIWebBrowserPersist.PERSIST_STATE_FINISHED))
-      {
+          && (!gPersistObj || gPersistObj.currentState == nsIWebBrowserPersist.PERSIST_STATE_FINISHED)) {
         aStateFlags |= nsIWebProgressListener.STATE_IS_NETWORK;
-        if (!gPersistObj)
-        {
+        if (!gPersistObj) {
           gPersistObj =
           {
-            result : aStatus,
-            currentState : nsIWebBrowserPersist.PERSIST_STATE_FINISHED
-          }
+            result: aStatus,
+            currentState: nsIWebBrowserPersist.PERSIST_STATE_FINISHED,
+          };
         }
       }
 
       // STATE_IS_NETWORK signals end of publishing, as does the gPersistObj.currentState
       if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK
-          && gPersistObj.currentState == nsIWebBrowserPersist.PERSIST_STATE_FINISHED)
-      {
-        if (GetScheme(gPublishData.publishUrl) == "file")
-        {
-          //XXX "file://" hack: We don't get notified about the HTML file, so end progress for it
+          && gPersistObj.currentState == nsIWebBrowserPersist.PERSIST_STATE_FINISHED) {
+        if (GetScheme(gPublishData.publishUrl) == "file") {
+          // XXX "file://" hack: We don't get notified about the HTML file, so end progress for it
           // (This covers both "Case 1 and 2" described above)
           gProgressDialog.SetProgressFinished(gPublishData.filename, gPersistObj.result);
         }
 
-        if (gPersistObj.result == 0)
-        {
+        if (gPersistObj.result == 0) {
           // All files are finished and publishing succeeded (some images may have failed)
           try {
             // Make a new docURI from the "browse location" in case "publish location" was FTP
             // We need to set document uri before notifying listeners
             var docUrl = GetDocUrlFromPublishData(gPublishData);
             SetDocumentURI(Services.io.newURI(docUrl, editor.documentCharacterSet));
 
             UpdateWindowTitle();
 
             // this should cause notification to listeners that doc has changed
             editor.resetModificationCount();
 
             // Set UI based on whether we're editing a remote or local url
             SetSaveAndPublishUI(urlstring);
-
           } catch (e) {}
 
           // Save publishData to prefs
-          if (gPublishData)
-          {
-            if (gPublishData.savePublishData)
-            {
+          if (gPublishData) {
+            if (gPublishData.savePublishData) {
               // We published successfully, so we can safely
               //  save docDir and otherDir to prefs
               gPublishData.saveDirs = true;
               SavePublishDataToPrefs(gPublishData);
-            }
-            else
+            } else
               SavePassword(gPublishData);
           }
 
           // Ask progress dialog to close, but it may not
           // if user checked checkbox to keep it open
           gProgressDialog.RequestCloseDialog();
-        }
-        else
-        {
+        } else {
           // We previously aborted publishing because of error:
           //   Calling gPersistObj.cancelSave() resulted in a non-zero gPersistObj.result,
           //   so notify progress dialog we're finished
           gProgressDialog.SetProgressFinished(null, 0);
         }
       }
     }
   },
 
-  onProgressChange : function(aWebProgress, aRequest, aCurSelfProgress,
-                              aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress)
-  {
+  onProgressChange(aWebProgress, aRequest, aCurSelfProgress,
+                              aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress) {
     if (!gPersistObj)
       return;
 
-    if (gShowDebugOutputProgress)
-    {
-      dump("\n onProgressChange: gPersistObj.result="+gPersistObj.result+"\n");
+    if (gShowDebugOutputProgress) {
+      dump("\n onProgressChange: gPersistObj.result=" + gPersistObj.result + "\n");
       try {
       var channel = aRequest.QueryInterface(nsIChannel);
       dump("***** onProgressChange request: " + channel.URI.spec + "\n");
-      }
-      catch (e) {}
-      dump("*****       self:  "+aCurSelfProgress+" / "+aMaxSelfProgress+"\n");
-      dump("*****       total: "+aCurTotalProgress+" / "+aMaxTotalProgress+"\n\n");
+      } catch (e) {}
+      dump("*****       self:  " + aCurSelfProgress + " / " + aMaxSelfProgress + "\n");
+      dump("*****       total: " + aCurTotalProgress + " / " + aMaxTotalProgress + "\n\n");
 
       if (gPersistObj.currentState == gPersistObj.PERSIST_STATE_READY)
         dump(" Persister is ready to save data\n\n");
       else if (gPersistObj.currentState == gPersistObj.PERSIST_STATE_SAVING)
         dump(" Persister is saving data.\n\n");
       else if (gPersistObj.currentState == gPersistObj.PERSIST_STATE_FINISHED)
         dump(" PERSISTER HAS FINISHED SAVING DATA\n\n\n");
     }
   },
 
-  onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags)
-  {
-    if (gShowDebugOutputLocationChange)
-    {
-      dump("***** onLocationChange: "+aLocation.spec+"\n");
+  onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
+    if (gShowDebugOutputLocationChange) {
+      dump("***** onLocationChange: " + aLocation.spec + "\n");
       try {
         var channel = aRequest.QueryInterface(nsIChannel);
         dump("*****          request: " + channel.URI.spec + "\n");
-      }
-      catch(e) {}
+      } catch (e) {}
     }
   },
 
-  onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage)
-  {
-    if (gShowDebugOutputStatusChange)
-    {
-      dump("***** onStatusChange: "+aMessage+"\n");
+  onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
+    if (gShowDebugOutputStatusChange) {
+      dump("***** onStatusChange: " + aMessage + "\n");
       try {
         var channel = aRequest.QueryInterface(nsIChannel);
         dump("*****        request: " + channel.URI.spec + "\n");
-      }
-      catch (e) { dump("          couldn't get request\n"); }
+      } catch (e) { dump("          couldn't get request\n"); }
 
       DumpDebugStatus(aStatus);
 
-      if (gPersistObj)
-      {
+      if (gPersistObj) {
         if (gPersistObj.currentState == gPersistObj.PERSIST_STATE_READY)
           dump(" Persister is ready to save data\n\n");
         else if (gPersistObj.currentState == gPersistObj.PERSIST_STATE_SAVING)
           dump(" Persister is saving data.\n\n");
         else if (gPersistObj.currentState == gPersistObj.PERSIST_STATE_FINISHED)
           dump(" PERSISTER HAS FINISHED SAVING DATA\n\n\n");
       }
     }
   },
 
-  onSecurityChange : function(aWebProgress, aRequest, state)
-  {
-    if (gShowDebugOutputSecurityChange)
-    {
+  onSecurityChange(aWebProgress, aRequest, state) {
+    if (gShowDebugOutputSecurityChange) {
       try {
         var channel = aRequest.QueryInterface(nsIChannel);
         dump("***** onSecurityChange request: " + channel.URI.spec + "\n");
       } catch (e) {}
     }
   },
 
-  onContentBlockingEvent: function(aWebProgress, aRequest, aEvent)
-  {
+  onContentBlockingEvent(aWebProgress, aRequest, aEvent) {
   },
 
   QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
                                           "nsISupportsWeakReference",
                                           "nsIPrompt",
                                           "nsIAuthPrompt"]),
 
 // nsIPrompt
-  alert : function(dlgTitle, text)
-  {
+  alert(dlgTitle, text) {
     Services.prompt.alert(gProgressDialog ? gProgressDialog : window, dlgTitle, text);
   },
-  alertCheck : function(dialogTitle, text, checkBoxLabel, checkObj)
-  {
+  alertCheck(dialogTitle, text, checkBoxLabel, checkObj) {
     Services.prompt.alert(window, dialogTitle, text);
   },
-  confirm : function(dlgTitle, text)
-  {
+  confirm(dlgTitle, text) {
     return ConfirmWithTitle(dlgTitle, text, null, null);
   },
-  confirmCheck : function(dlgTitle, text, checkBoxLabel, checkObj)
-  {
+  confirmCheck(dlgTitle, text, checkBoxLabel, checkObj) {
     Services.prompt.confirmEx(window, dlgTitle, text, nsIPromptService.STD_OK_CANCEL_BUTTONS,
                               "", "", "", checkBoxLabel, checkObj);
   },
-  confirmEx : function(dlgTitle, text, btnFlags, btn0Title, btn1Title, btn2Title, checkBoxLabel, checkVal)
-  {
+  confirmEx(dlgTitle, text, btnFlags, btn0Title, btn1Title, btn2Title, checkBoxLabel, checkVal) {
     return Services.prompt.confirmEx(window, dlgTitle, text, btnFlags,
                                      btn0Title, btn1Title, btn2Title,
                                      checkBoxLabel, checkVal);
   },
 
-  /*************************************************************************
+  /** ***********************************************************************
    * gEditorOutputProgressListener needs to implement both nsIPrompt       *
    * (providing alert) and nsIAuthPrompt (providing password saving).      *
    * Unfortunately, both interfaces specify prompt/promptPassword/         *
    * promptUsernameAndPassword, albeit with conflicting method signatures. *
    * Luckily, though, we only make use of their nsIAuthPrompt variants,    *
    * hence we can comment out the nsIPrompt ones here to avoid JavaScript  *
    * strict mode clutter. See bug 371174 for more information.             *
    *************************************************************************
@@ -1367,101 +1236,92 @@ var gEditorOutputProgressListener =
     var ret = PromptUsernameAndPassword(dlgTitle, text, savePWObj.value, userObj, pwObj);
     if (!ret)
       setTimeout(CancelPublishing, 0);
 
     return ret;
   },
    *************************************************************************/
 
-  select : function(dlgTitle, text, count, selectList, outSelection)
-  {
+  select(dlgTitle, text, count, selectList, outSelection) {
     return Services.prompt.select(window, dlgTitle, text, count, selectList, outSelection);
   },
 
 // nsIAuthPrompt
-  prompt : function(dlgTitle, text, pwrealm, savePW, defaultText, result)
-  {
+  prompt(dlgTitle, text, pwrealm, savePW, defaultText, result) {
     var ret = Services.prompt.prompt(gProgressDialog ? gProgressDialog : window,
                                      dlgTitle, text, defaultText, pwrealm, savePWObj);
     if (!ret)
       setTimeout(CancelPublishing, 0);
     return ret;
   },
 
-  promptUsernameAndPassword : function(dlgTitle, text, pwrealm, savePW, userObj, pwObj)
-  {
+  promptUsernameAndPassword(dlgTitle, text, pwrealm, savePW, userObj, pwObj) {
     var ret = PromptUsernameAndPassword(dlgTitle, text, savePW, userObj, pwObj);
     if (!ret)
       setTimeout(CancelPublishing, 0);
     return ret;
   },
 
-  promptPassword : function(dlgTitle, text, pwrealm, savePW, pwObj)
-  {
+  promptPassword(dlgTitle, text, pwrealm, savePW, pwObj) {
     var ret = false;
     try {
       // Note difference with nsIPrompt::promptPassword, which has
       // "inout" savePassword param, while nsIAuthPrompt is just "in"
       // Also nsIAuth doesn't supply "checkBoxLabel"
       // Initialize with user's previous preference for this site
-      var savePWObj = {value:savePW};
+      var savePWObj = {value: savePW};
       // Initialize with user's previous preference for this site
       if (gPublishData)
         savePWObj.value = gPublishData.savePassword;
 
       ret = Services.prompt.promptPassword(gProgressDialog ? gProgressDialog : window,
                                            dlgTitle, text, pwObj, GetString("SavePassword"), savePWObj);
 
       if (!ret)
         setTimeout(CancelPublishing, 0);
 
       if (ret && gPublishData)
         UpdateUsernamePasswordFromPrompt(gPublishData, gPublishData.username, pwObj.value, savePWObj.value);
-    } catch(e) {}
+    } catch (e) {}
 
     return ret;
-  }
-}
-
-function PromptUsernameAndPassword(dlgTitle, text, savePW, userObj, pwObj)
-{
+  },
+};
+
+function PromptUsernameAndPassword(dlgTitle, text, savePW, userObj, pwObj) {
   // HTTP prompts us twice even if user Cancels from 1st attempt!
   // So never put up dialog if there's no publish data
   if (!gPublishData)
-    return false
+    return false;
 
   var ret = false;
   try {
-
-    var savePWObj = {value:savePW};
+    var savePWObj = {value: savePW};
 
     // Initialize with user's previous preference for this site
-    if (gPublishData)
-    {
+    if (gPublishData) {
       // HTTP put uses this dialog if either username or password is bad,
       //   so prefill username input field with the previous value for modification
       savePWObj.value = gPublishData.savePassword;
       if (!userObj.value)
         userObj.value = gPublishData.username;
     }
 
     ret = Services.prompt.promptUsernameAndPassword(gProgressDialog ? gProgressDialog : window,
                                                     dlgTitle, text, userObj, pwObj,
                                                     GetString("SavePassword"), savePWObj);
     if (ret && gPublishData)
       UpdateUsernamePasswordFromPrompt(gPublishData, userObj.value, pwObj.value, savePWObj.value);
-
   } catch (e) {}
 
   return ret;
 }
 
-function DumpDebugStatus(aStatus)
-{
+function DumpDebugStatus(aStatus) {
   // see nsError.h and netCore.h and ftpCore.h
 
   if (aStatus == kErrorBindingAborted)
     dump("***** status is NS_BINDING_ABORTED\n");
   else if (aStatus == kErrorBindingRedirected)
     dump("***** status is NS_BINDING_REDIRECTED\n");
   else if (aStatus == 2152398859) // in netCore.h 11
     dump("***** status is ALREADY_CONNECTED\n");
@@ -1529,18 +1389,17 @@ function DumpDebugStatus(aStatus)
     dump("***** status is ACCESS_DENIED\n");
   else if (aStatus == 2152398878)
     dump("***** status is ? (No connection or time out?)\n");
   else
     dump("***** status is " + aStatus + "\n");
 }
 
 // Update any data that the user supplied in a prompt dialog
-function UpdateUsernamePasswordFromPrompt(publishData, username, password, savePassword)
-{
+function UpdateUsernamePasswordFromPrompt(publishData, username, password, savePassword) {
   if (!publishData)
     return;
 
   // Set flag to save publish data after publishing if it changed in dialog
   //  and the "SavePassword" checkbox was checked
   //  or we already had site data for this site
   // (Thus we don't automatically create a site until user brings up Publish As dialog)
   publishData.savePublishData = (gPublishData.username != username || gPublishData.password != password)
@@ -1558,32 +1417,29 @@ const kSupportedTextMimeTypes =
   "text/rdf",
   "text/xsl",
   "text/javascript",
   "text/ecmascript",
   "application/javascript",
   "application/ecmascript",
   "application/x-javascript",
   "text/xul",
-  "application/vnd.mozilla.xul+xml"
+  "application/vnd.mozilla.xul+xml",
 ];
 
-function IsSupportedTextMimeType(aMimeType)
-{
-  for (var i = 0; i < kSupportedTextMimeTypes.length; i++)
-  {
+function IsSupportedTextMimeType(aMimeType) {
+  for (var i = 0; i < kSupportedTextMimeTypes.length; i++) {
     if (kSupportedTextMimeTypes[i] == aMimeType)
       return true;
   }
   return false;
 }
 
 // throws an error or returns true if user attempted save; false if user canceled save
-async function SaveDocument(aSaveAs, aSaveCopy, aMimeType)
-{
+async function SaveDocument(aSaveAs, aSaveCopy, aMimeType) {
   var editor = GetCurrentEditor();
   if (!aMimeType || !editor)
     throw Cr.NS_ERROR_NOT_INITIALIZED;
 
   var editorDoc = editor.document;
   if (!editorDoc)
     throw Cr.NS_ERROR_NOT_INITIALIZED;
 
@@ -1608,22 +1464,20 @@ async function SaveDocument(aSaveAs, aSa
   if (!mustShowFileDialog && GetScheme(urlstring) != "file")
     mustShowFileDialog = true;
 
   var replacing = !aSaveAs;
   var titleChanged = false;
   var doUpdateURI = false;
   var tempLocalFile = null;
 
-  if (mustShowFileDialog)
-  {
+  if (mustShowFileDialog) {
     try {
       // Prompt for title if we are saving to HTML
-      if (!saveAsTextFile && (editorType == "html"))
-      {
+      if (!saveAsTextFile && (editorType == "html")) {
         var userContinuing = PromptAndSetTitleIfNone(); // not cancel
         if (!userContinuing)
           return false;
       }
 
       var dialogResult = await PromptForSaveLocation(saveAsTextFile, editorType, aMimeType, urlstring);
       if (!dialogResult)
         return false;
@@ -1641,80 +1495,69 @@ async function SaveDocument(aSaveAs, aSa
     }
   } // mustShowFileDialog
 
   var success = true;
   try {
     // if somehow we didn't get a local file but we did get a uri,
     // attempt to create the localfile if it's a "file" url
     var docURI;
-    if (!tempLocalFile)
-    {
+    if (!tempLocalFile) {
       docURI = Services.io.newURI(urlstring, editor.documentCharacterSet);
 
-      if (docURI.schemeIs("file"))
-      {
+      if (docURI.schemeIs("file")) {
         var fileHandler = GetFileProtocolHandler();
         tempLocalFile = fileHandler.getFileFromURLSpec(urlstring).QueryInterface(Ci.nsIFile);
       }
     }
 
     // this is the location where the related files will go
     var relatedFilesDir = null;
 
     // Only change links or move files if pref is set
     // and we are saving to a new location
-    if (Services.prefs.getBoolPref("editor.save_associated_files") && aSaveAs)
-    {
+    if (Services.prefs.getBoolPref("editor.save_associated_files") && aSaveAs) {
       try {
-        if (tempLocalFile)
-        {
+        if (tempLocalFile) {
           // if we are saving to the same parent directory, don't set relatedFilesDir
           // grab old location, chop off file
           // grab new location, chop off file, compare
           var oldLocation = GetDocumentUrl();
           var oldLocationLastSlash = oldLocation.lastIndexOf("\/");
           if (oldLocationLastSlash != -1)
             oldLocation = oldLocation.slice(0, oldLocationLastSlash);
 
           var relatedFilesDirStr = urlstring;
           var newLocationLastSlash = relatedFilesDirStr.lastIndexOf("\/");
           if (newLocationLastSlash != -1)
             relatedFilesDirStr = relatedFilesDirStr.slice(0, newLocationLastSlash);
           if (oldLocation == relatedFilesDirStr || IsUrlAboutBlank(oldLocation))
             relatedFilesDir = null;
           else
             relatedFilesDir = tempLocalFile.parent;
-        }
-        else
-        {
+        } else {
           var lastSlash = urlstring.lastIndexOf("\/");
-          if (lastSlash != -1)
-          {
+          if (lastSlash != -1) {
             var relatedFilesDirString = urlstring.slice(0, lastSlash + 1);  // include last slash
             relatedFilesDir = Services.io.newURI(relatedFilesDirString, editor.documentCharacterSet);
           }
         }
-      } catch(e) { relatedFilesDir = null; }
+      } catch (e) { relatedFilesDir = null; }
     }
 
     let destinationLocation = tempLocalFile ? tempLocalFile : docURI;
 
     success = OutputFileWithPersistAPI(editorDoc, destinationLocation, relatedFilesDir, aMimeType);
-  }
-  catch (e)
-  {
+  } catch (e) {
     success = false;
   }
 
-  if (success)
-  {
+  if (success) {
     try {
-      if (doUpdateURI)
-      {
+      if (doUpdateURI) {
          // If a local file, we must create a new uri from nsIFile
         if (tempLocalFile)
           docURI = GetFileProtocolHandler().newFileURI(tempLocalFile);
 
         // We need to set new document uri before notifying listeners
         SetDocumentURI(docURI);
       }
 
@@ -1725,176 +1568,158 @@ async function SaveDocument(aSaveAs, aSa
 
       if (!aSaveCopy)
         editor.resetModificationCount();
       // this should cause notification to listeners that document has changed
 
       // Set UI based on whether we're editing a remote or local url
       SetSaveAndPublishUI(urlstring);
     } catch (e) {}
-  }
-  else
-  {
+  } else {
     Services.prompt.alert(window, GetString("SaveDocument"), GetString("SaveFileFailed"));
   }
   return success;
 }
 
-function SetDocumentURI(uri)
-{
+function SetDocumentURI(uri) {
   try {
     // XXX WE'LL NEED TO GET "CURRENT" CONTENT FRAME ONCE MULTIPLE EDITORS ARE ALLOWED
     GetCurrentEditorElement().docShell.setCurrentURI(uri);
-  } catch (e) { dump("SetDocumentURI:\n"+e +"\n"); }
+  } catch (e) { dump("SetDocumentURI:\n" + e + "\n"); }
 }
 
 
-//-------------------------------  Publishing
+// -------------------------------  Publishing
 var gPublishData;
 var gProgressDialog;
 var gCommandAfterPublishing = null;
 var gRestoreDocumentSource;
 
-function Publish(publishData)
-{
+function Publish(publishData) {
   if (!publishData)
     return false;
 
   // Set data in global for username password requests
   //  and to do "post saving" actions after monitoring nsIWebProgressListener messages
   //  and we are sure file transfer was successful
   gPublishData = publishData;
 
   gPublishData.docURI = CreateURIFromPublishData(publishData, true);
-  if (!gPublishData.docURI)
-  {
+  if (!gPublishData.docURI) {
     Services.prompt.alert(window, GetString("Publish"), GetString("PublishFailed"));
     return false;
   }
 
   if (gPublishData.publishOtherFiles)
     gPublishData.otherFilesURI = CreateURIFromPublishData(publishData, false);
   else
     gPublishData.otherFilesURI = null;
 
-  if (gShowDebugOutputStateChange)
-  {
-    dump("\n *** publishData: PublishUrl="+publishData.publishUrl+", BrowseUrl="+publishData.browseUrl+
-      ", Username="+publishData.username+", Dir="+publishData.docDir+
-      ", Filename="+publishData.filename+"\n");
-    dump(" * gPublishData.docURI.spec w/o pass="+StripPassword(gPublishData.docURI.spec)+", PublishOtherFiles="+gPublishData.publishOtherFiles+"\n");
+  if (gShowDebugOutputStateChange) {
+    dump("\n *** publishData: PublishUrl=" + publishData.publishUrl + ", BrowseUrl=" + publishData.browseUrl +
+      ", Username=" + publishData.username + ", Dir=" + publishData.docDir +
+      ", Filename=" + publishData.filename + "\n");
+    dump(" * gPublishData.docURI.spec w/o pass=" + StripPassword(gPublishData.docURI.spec) + ", PublishOtherFiles=" + gPublishData.publishOtherFiles + "\n");
   }
 
   // XXX Missing username will make FTP fail
   // and it won't call us for prompt dialog (bug 132320)
   // (It does prompt if just password is missing)
   // So we should do the prompt ourselves before trying to publish
-  if (GetScheme(publishData.publishUrl) == "ftp" && !publishData.username)
-  {
+  if (GetScheme(publishData.publishUrl) == "ftp" && !publishData.username) {
     var message = GetString("PromptFTPUsernamePassword").replace(/%host%/, GetHost(publishData.publishUrl));
-    var savePWobj = {value:publishData.savePassword};
-    var userObj = {value:publishData.username};
-    var pwObj = {value:publishData.password};
+    var savePWobj = {value: publishData.savePassword};
+    var userObj = {value: publishData.username};
+    var pwObj = {value: publishData.password};
     if (!PromptUsernameAndPassword(GetString("Prompt"), message, savePWobj, userObj, pwObj))
       return false; // User canceled out of dialog
 
     // Reset data in URI objects
     gPublishData.docURI.username = publishData.username;
     gPublishData.docURI.password = publishData.password;
 
-    if (gPublishData.otherFilesURI)
-    {
+    if (gPublishData.otherFilesURI) {
       gPublishData.otherFilesURI.username = publishData.username;
       gPublishData.otherFilesURI.password = publishData.password;
     }
   }
 
   try {
     // We launch dialog as a dependent
     // Don't allow editing document!
     SetDocumentEditable(false);
 
     // Start progress monitoring
     gProgressDialog =
       window.openDialog("chrome://editor/content/EditorPublishProgress.xul", "_blank",
                         "chrome,dependent,titlebar", gPublishData, gPersistObj);
-
   } catch (e) {}
 
   // Network transfer is often too quick for the progress dialog to be initialized
   //  and we can completely miss messages for quickly-terminated bad URLs,
   //  so we can't call OutputFileWithPersistAPI right away.
   // StartPublishing() is called at the end of the dialog's onload method
   return true;
 }
 
-function StartPublishing()
-{
+function StartPublishing() {
   var editor = GetCurrentEditor();
-  if (editor && gPublishData && gPublishData.docURI && gProgressDialog)
-  {
+  if (editor && gPublishData && gPublishData.docURI && gProgressDialog) {
     gRestoreDocumentSource = null;
 
     // Save backup document since nsIWebBrowserPersist changes image src urls
     // but we only need to do this if publishing images and other related files
-    if (gPublishData.otherFilesURI)
-    {
+    if (gPublishData.otherFilesURI) {
       try {
         gRestoreDocumentSource =
           editor.outputToString(editor.contentsMIMEType, kOutputEncodeW3CEntities);
       } catch (e) {}
     }
 
     OutputFileWithPersistAPI(editor.document,
                              gPublishData.docURI, gPublishData.otherFilesURI,
                              editor.contentsMIMEType);
     return gPersistObj;
   }
   return null;
 }
 
-function CancelPublishing()
-{
+function CancelPublishing() {
   try {
     gPersistObj.cancelSave();
     gProgressDialog.SetProgressStatusCancel();
   } catch (e) {}
 
   // If canceling publishing do not do any commands after this
   gCommandAfterPublishing = null;
 
-  if (gProgressDialog)
-  {
+  if (gProgressDialog) {
     // Close Progress dialog
     // (this will call FinishPublishing())
     gProgressDialog.CloseDialog();
-  }
-  else
+  } else
     FinishPublishing();
 }
 
-function FinishPublishing()
-{
+function FinishPublishing() {
   SetDocumentEditable(true);
   gProgressDialog = null;
   gPublishData = null;
   gRestoreDocumentSource = null;
 
-  if (gCommandAfterPublishing)
-  {
+  if (gCommandAfterPublishing) {
     // Be sure to null out the global now in case of trouble when executing command
     var command = gCommandAfterPublishing;
     gCommandAfterPublishing = null;
     goDoCommand(command);
   }
 }
 
 // Create a nsIURI object filled in with all required publishing info
-function CreateURIFromPublishData(publishData, doDocUri)
-{
+function CreateURIFromPublishData(publishData, doDocUri) {
   if (!publishData || !publishData.publishUrl)
     return null;
 
   var URI;
   try {
     var spec = publishData.publishUrl;
     if (doDocUri)
       spec += FormatDirForPublishing(publishData.docDir) + publishData.filename;
@@ -1902,25 +1727,23 @@ function CreateURIFromPublishData(publis
       spec += FormatDirForPublishing(publishData.otherDir);
 
     URI = Services.io.newURI(spec, GetCurrentEditor().documentCharacterSet);
 
     if (publishData.username)
       URI.username = publishData.username;
     if (publishData.password)
       URI.password = publishData.password;
-  }
-  catch (e) {}
+  } catch (e) {}
 
   return URI;
 }
 
 // Resolve the correct "http:" document URL when publishing via ftp
-function GetDocUrlFromPublishData(publishData)
-{
+function GetDocUrlFromPublishData(publishData) {
   if (!publishData || !publishData.filename || !publishData.publishUrl)
     return "";
 
   // If user was previously editing an "ftp" url, then keep that as the new scheme
   var url;
   var docScheme = GetScheme(GetDocumentUrl());
 
   // Always use the "HTTP" address if available
@@ -1934,151 +1757,136 @@ function GetDocUrlFromPublishData(publis
   url += FormatDirForPublishing(publishData.docDir) + publishData.filename;
 
   if (GetScheme(url) == "ftp")
     url = InsertUsernameIntoUrl(url, publishData.username);
 
   return url;
 }
 
-function SetSaveAndPublishUI(urlstring)
-{
+function SetSaveAndPublishUI(urlstring) {
   // Be sure enabled state of toolbar buttons are correct
   goUpdateCommand("cmd_save");
   goUpdateCommand("cmd_publish");
 }
 
-function SetDocumentEditable(isDocEditable)
-{
+function SetDocumentEditable(isDocEditable) {
   var editor = GetCurrentEditor();
-  if (editor && editor.document)
-  {
+  if (editor && editor.document) {
     try {
       var flags = editor.flags;
       editor.flags = isDocEditable ?
             flags &= ~nsIPlaintextEditor.eEditorReadonlyMask :
             flags | nsIPlaintextEditor.eEditorReadonlyMask;
-    } catch(e) {}
+    } catch (e) {}
 
     // update all commands
     window.updateCommands("create");
   }
 }
 
 // ****** end of save / publish **********//
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsPublishSettingsCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    if (GetCurrentEditor())
-    {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    if (GetCurrentEditor()) {
       // Launch Publish Settings dialog
 
-      window.ok = window.openDialog("chrome://editor/content/EditorPublishSettings.xul","_blank", "chrome,close,titlebar,modal", "");
+      window.ok = window.openDialog("chrome://editor/content/EditorPublishSettings.xul", "_blank", "chrome,close,titlebar,modal", "");
       return window.ok;
     }
     return false;
-  }
-}
-
-//-----------------------------------------------------------------------------------
+  },
+};
+
+// -----------------------------------------------------------------------------------
 var nsRevertCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() &&
             IsDocumentModified() &&
             !IsUrlAboutBlank(GetDocumentUrl()));
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // Confirm with the user to abandon current changes
     // Put the page title in the message string
     let title = GetDocumentTitle();
-    let msg = GetString("AbandonChanges").replace(/%title%/,title);
+    let msg = GetString("AbandonChanges").replace(/%title%/, title);
 
     let result = Services.prompt.confirmEx(window, GetString("RevertCaption"), msg,
                    (Services.prompt.BUTTON_TITLE_REVERT * Services.prompt.BUTTON_POS_0) +
                    (Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1),
-                   null, null, null, null, {value:0});
+                   null, null, null, null, {value: 0});
 
     // Reload page if first button (Revert) was pressed
-    if (result == 0)
-    {
+    if (result == 0) {
       CancelHTMLSource();
       EditorLoadUrl(GetDocumentUrl());
     }
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsCloseCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return GetCurrentEditor() != null;
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     CloseWindow();
-  }
+  },
 };
 
-async function CloseWindow()
-{
+async function CloseWindow() {
   // Check to make sure document is saved. "true" means allow "Don't Save" button,
   //   so user can choose to close without saving
-  if (await CheckAndSaveDocument("cmd_close", true))
-  {
+  if (await CheckAndSaveDocument("cmd_close", true)) {
     if (window.InsertCharWindow)
       SwitchInsertCharToAnotherEditorOrClose();
 
     try {
       var basewin = window.QueryInterface(Ci.nsIInterfaceRequestor)
                       .getInterface(Ci.nsIWebNavigation)
                       .QueryInterface(Ci.nsIDocShellTreeItem)
                       .treeOwner
                       .QueryInterface(Ci.nsIInterfaceRequestor)
                       .getInterface(Ci.nsIBaseWindow);
       basewin.destroy();
     } catch (e) {}
   }
 }
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsOpenRemoteCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return true;    // we can always do this
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     var params = { action: "2", url: "" };
     openDialog("chrome://communicator/content/openLocation.xul", "_blank", "chrome,modal,titlebar", params);
     var win = getTopWin();
     switch (params.action) {
       case "0": // current window
         win.focus();
         win.loadURI(params.url, null, null, true);
         break;
@@ -2095,1604 +1903,1438 @@ var nsOpenRemoteCommand =
         browser.selectedTab = browser.addTab(params.url, {allowThirdPartyFixup: true});
         break;
       case "4": // private
         openNewPrivateWith(params.url);
         break;
       default:
         break;
     }
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsPreviewCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() &&
             IsHTMLEditor() &&
             (DocumentHasBeenSaved() || IsDocumentModified()));
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: async function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  async doCommand(aCommand) {
     // Don't continue if user canceled during prompt for saving
     // DocumentHasBeenSaved will test if we have a URL and suppress "Don't Save" button if not
     if (!(await CheckAndSaveDocument("cmd_preview", DocumentHasBeenSaved())))
       return;
 
     // Check if we saved again just in case?
-    if (DocumentHasBeenSaved())
-    {
+    if (DocumentHasBeenSaved()) {
       let browser;
       try {
         // Find a browser with this URL
         let enumerator = Services.wm.getEnumerator("navigator:browser");
 
         var documentURI = GetDocumentUrl();
-        while (enumerator.hasMoreElements())
-        {
+        while (enumerator.hasMoreElements()) {
           browser = enumerator.getNext();
           if (browser && (documentURI == browser.getBrowser().currentURI.spec))
             break;
 
           browser = null;
         }
-      }
-      catch (ex) {}
+      } catch (ex) {}
 
       // If none found, open a new browser
-      if (!browser)
-      {
+      if (!browser) {
         browser = window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", documentURI);
-      }
-      else
-      {
+      } else {
         try {
           browser.BrowserReloadSkipCache();
           browser.focus();
         } catch (ex) {}
       }
     }
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsSendPageCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() &&
             (DocumentHasBeenSaved() || IsDocumentModified()));
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: async function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  async doCommand(aCommand) {
     // Don't continue if user canceled during prompt for saving
     // DocumentHasBeenSaved will test if we have a URL and suppress "Don't Save" button if not
     if (!(await CheckAndSaveDocument("cmd_editSendPage", DocumentHasBeenSaved())))
       return;
 
     // Check if we saved again just in case?
-    if (DocumentHasBeenSaved())
-    {
+    if (DocumentHasBeenSaved()) {
       // Launch Messenger Composer window with current page as contents
-      try
-      {
+      try {
         openComposeWindow(GetDocumentUrl(), GetDocumentTitle());
       } catch (ex) { dump("Cannot Send Page: " + ex + "\n"); }
     }
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsPrintCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return true;    // we can always do this
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // In editor.js
     SetEditMode(gPreviousNonSourceDisplayMode);
     try {
       let browser = GetCurrentEditorElement();
       PrintUtils.printWindow(browser.outerWindowID, browser);
     } catch (e) {}
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsPrintPreviewCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return true;    // we can always do this
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // In editor.js
     SetEditMode(gPreviousNonSourceDisplayMode);
     try {
       PrintUtils.printPreview(PrintPreviewListener);
     } catch (e) {}
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsPrintSetupCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return true;    // we can always do this
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // In editor.js
     SetEditMode(gPreviousNonSourceDisplayMode);
     PrintUtils.showPageSetup();
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsFindReplaceCommand =
 {
-  isCommandEnabled: function(aCommand, editorElement)
-  {
+  isCommandEnabled(aCommand, editorElement) {
     return editorElement.getEditor(editorElement.contentWindow) != null;
   },
 
-  getCommandStateParams: function(aCommand, aParams, editorElement) {},
-  doCommandParams: function(aCommand, aParams, editorElement) {},
-
-  doCommand: function(aCommand, editorElement)
-  {
+  getCommandStateParams(aCommand, aParams, editorElement) {},
+  doCommandParams(aCommand, aParams, editorElement) {},
+
+  doCommand(aCommand, editorElement) {
     window.openDialog("chrome://editor/content/EdReplace.xul", "_blank",
                       "chrome,modal,titlebar", editorElement);
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsFindCommand =
 {
-  isCommandEnabled: function(aCommand, editorElement)
-  {
+  isCommandEnabled(aCommand, editorElement) {
     return editorElement.getEditor(editorElement.contentWindow) != null;
   },
 
-  getCommandStateParams: function(aCommand, aParams, editorElement) {},
-  doCommandParams: function(aCommand, aParams, editorElement) {},
-
-  doCommand: function(aCommand, editorElement)
-  {
+  getCommandStateParams(aCommand, aParams, editorElement) {},
+  doCommandParams(aCommand, aParams, editorElement) {},
+
+  doCommand(aCommand, editorElement) {
     document.getElementById("FindToolbar").onFindCommand();
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsFindAgainCommand =
 {
-  isCommandEnabled: function(aCommand, editorElement)
-  {
+  isCommandEnabled(aCommand, editorElement) {
     // we can only do this if the search pattern is non-empty. Not sure how
     // to get that from here
     return editorElement.getEditor(editorElement.contentWindow) != null;
   },
 
-  getCommandStateParams: function(aCommand, aParams, editorElement) {},
-  doCommandParams: function(aCommand, aParams, editorElement) {},
-
-  doCommand: function(aCommand, editorElement)
-  {
+  getCommandStateParams(aCommand, aParams, editorElement) {},
+  doCommandParams(aCommand, aParams, editorElement) {},
+
+  doCommand(aCommand, editorElement) {
     let findPrev = (aCommand == "cmd_findPrev");
     document.getElementById("FindToolbar").onFindAgainCommand(findPrev);
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsRewrapCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && !IsInHTMLSourceMode() &&
             GetCurrentEditor() instanceof Ci.nsIEditorMailSupport);
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     GetCurrentEditor().QueryInterface(Ci.nsIEditorMailSupport).rewrap(false);
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsSpellingCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() &&
             !IsInHTMLSourceMode() && IsSpellCheckerInstalled());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     window.cancelSendMessage = false;
     try {
       var skipBlockQuotes = (window.document.documentElement.getAttribute("windowtype") == "msgcompose");
       window.openDialog("chrome://editor/content/EdSpellCheck.xul", "_blank",
               "dialog,close,titlebar,modal,resizable", false, skipBlockQuotes, true);
-    }
-    catch(ex) {}
-  }
+    } catch (ex) {}
+  },
 };
 
 // Validate using http://validator.w3.org/file-upload.html
 var URL2Validate;
 var nsValidateCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return GetCurrentEditor() != null;
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: async function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  async doCommand(aCommand) {
     // If the document hasn't been modified,
     // then just validate the current url.
-    if (IsDocumentModified() || IsHTMLSourceChanged())
-    {
+    if (IsDocumentModified() || IsHTMLSourceChanged()) {
       if (!(await CheckAndSaveDocument("cmd_validate", false)))
         return;
 
       // Check if we saved again just in case?
       if (!DocumentHasBeenSaved())    // user hit cancel?
         return;
     }
 
     URL2Validate = GetDocumentUrl();
     // See if it's a file:
     var ifile;
     try {
       var fileHandler = GetFileProtocolHandler();
       ifile = fileHandler.getFileFromURLSpec(URL2Validate);
       // nsIFile throws an exception if it's not a file url
     } catch (e) { ifile = null; }
-    if (ifile)
-    {
+    if (ifile) {
       URL2Validate = ifile.path;
       var vwin = window.open("http://validator.w3.org/file-upload.html",
                              "EditorValidate");
       // Window loads asynchronously, so pass control to the load listener:
       vwin.addEventListener("load", this.validateFilePageLoaded);
-    }
-    else
-    {
+    } else {
       var vwin2 = window.open("http://validator.w3.org/check?uri="
                               + URL2Validate
                               + "&doctype=Inline",
                               "EditorValidate");
       // This does the validation, no need to wait for page loaded.
     }
   },
-  validateFilePageLoaded: function(event)
-  {
+  validateFilePageLoaded(event) {
     event.target.forms[0].uploaded_file.value = URL2Validate;
-  }
+  },
 };
 
 var nsCheckLinksCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    window.openDialog("chrome://editor/content/EdLinkChecker.xul","_blank", "chrome,close,titlebar,modal");
-  }
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    window.openDialog("chrome://editor/content/EdLinkChecker.xul", "_blank", "chrome,close,titlebar,modal");
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsFormCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     window.openDialog("chrome://editor/content/EdFormProps.xul", "_blank", "chrome,close,titlebar,modal");
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsInputTagCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     window.openDialog("chrome://editor/content/EdInputProps.xul", "_blank", "chrome,close,titlebar,modal");
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsInputImageCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     window.openDialog("chrome://editor/content/EdInputImage.xul", "_blank", "chrome,close,titlebar,modal");
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsTextAreaCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     window.openDialog("chrome://editor/content/EdTextAreaProps.xul", "_blank", "chrome,close,titlebar,modal");
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsSelectCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     window.openDialog("chrome://editor/content/EdSelectProps.xul", "_blank", "chrome,close,titlebar,modal");
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsButtonCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     window.openDialog("chrome://editor/content/EdButtonProps.xul", "_blank", "chrome,close,titlebar,modal");
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsLabelCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     var tagName = "label";
     try {
       var editor = GetCurrentEditor();
       // Find selected label or if start/end of selection is in label
       var labelElement = editor.getSelectedElement(tagName);
       if (!labelElement)
         labelElement = editor.getElementOrParentByTagName(tagName, editor.selection.anchorNode);
       if (!labelElement)
         labelElement = editor.getElementOrParentByTagName(tagName, editor.selection.focusNode);
       if (labelElement) {
         // We only open the dialog for an existing label
         window.openDialog("chrome://editor/content/EdLabelProps.xul", "_blank", "chrome,close,titlebar,modal", labelElement);
       } else {
         EditorSetTextProperty(tagName, "", "");
       }
     } catch (e) {}
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsFieldSetCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     window.openDialog("chrome://editor/content/EdFieldSetProps.xul", "_blank", "chrome,close,titlebar,modal");
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsIsIndexCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       var editor = GetCurrentEditor();
       var isindexElement = editor.createElementWithDefaults("isindex");
       isindexElement.setAttribute("prompt", editor.outputToString("text/plain", kOutputSelectionOnly));
       editor.insertElementAtSelection(isindexElement, true);
     } catch (e) {}
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsImageCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    window.openDialog("chrome://editor/content/EdImageProps.xul","_blank", "chrome,close,titlebar,modal");
-  }
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    window.openDialog("chrome://editor/content/EdImageProps.xul", "_blank", "chrome,close,titlebar,modal");
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsHLineCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // Inserting an HLine is different in that we don't use properties dialog
     //  unless we are editing an existing line's attributes
     //  We get the last-used attributes from the prefs and insert immediately
 
     var tagName = "hr";
     var editor = GetCurrentEditor();
 
     var hLine;
     try {
       hLine = editor.getSelectedElement(tagName);
-    } catch (e) {return;}
-
-    if (hLine)
-    {
+    } catch (e) { return; }
+
+    if (hLine) {
       // We only open the dialog for an existing HRule
       window.openDialog("chrome://editor/content/EdHLineProps.xul", "_blank", "chrome,close,titlebar,modal");
-    }
-    else
-    {
+    } else {
       try {
         hLine = editor.createElementWithDefaults(tagName);
 
         // We change the default attributes to those saved in the user prefs
         let align = Services.prefs.getIntPref("editor.hrule.align");
         if (align == 0)
           editor.setAttributeOrEquivalent(hLine, "align", "left", true);
         else if (align == 2)
           editor.setAttributeOrEquivalent(hLine, "align", "right", true);
 
-        //Note: Default is center (don't write attribute)
+        // Note: Default is center (don't write attribute)
 
         let width = Services.prefs.getIntPref("editor.hrule.width");
         if (Services.prefs.getBoolPref("editor.hrule.width_percent"))
-          width = width +"%";
+          width = width + "%";
 
         editor.setAttributeOrEquivalent(hLine, "width", width, true);
 
         let height = Services.prefs.getIntPref("editor.hrule.height");
         editor.setAttributeOrEquivalent(hLine, "size", String(height), true);
 
         if (Services.prefs.getBoolPref("editor.hrule.shading"))
           hLine.removeAttribute("noshade");
         else
           hLine.setAttribute("noshade", "noshade");
 
         editor.insertElementAtSelection(hLine, true);
-
       } catch (e) {}
     }
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsLinkCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // If selected element is an image, launch that dialog instead
     // since last tab panel handles link around an image
     var element = GetObjectForProperties();
     if (element && element.nodeName.toLowerCase() == "img")
-      window.openDialog("chrome://editor/content/EdImageProps.xul","_blank", "chrome,close,titlebar,modal", null, true);
+      window.openDialog("chrome://editor/content/EdImageProps.xul", "_blank", "chrome,close,titlebar,modal", null, true);
     else
-      window.openDialog("chrome://editor/content/EdLinkProps.xul","_blank", "chrome,close,titlebar,modal");
-  }
+      window.openDialog("chrome://editor/content/EdLinkProps.xul", "_blank", "chrome,close,titlebar,modal");
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsAnchorCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     window.openDialog("chrome://editor/content/EdNamedAnchorProps.xul", "_blank", "chrome,close,titlebar,modal", "");
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsInsertHTMLWithDialogCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    window.openDialog("chrome://editor/content/EdInsSrc.xul","_blank", "chrome,close,titlebar,modal,resizable", "");
-  }
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    window.openDialog("chrome://editor/content/EdInsSrc.xul", "_blank", "chrome,close,titlebar,modal,resizable", "");
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsInsertMathWithDialogCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     window.openDialog("chrome://editor/content/EdInsertMath.xul", "_blank", "chrome,close,titlebar,modal,resizable", "");
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsInsertCharsCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     EditorFindOrCreateInsertCharWindow();
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsInsertBreakCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentEditor().insertHTML("<br>");
     } catch (e) {}
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsInsertBreakAllCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentEditor().insertHTML("<br clear='all'>");
     } catch (e) {}
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsGridCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    window.openDialog("chrome://editor/content/EdSnapToGrid.xul","_blank", "chrome,close,titlebar,modal");
-  }
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    window.openDialog("chrome://editor/content/EdSnapToGrid.xul", "_blank", "chrome,close,titlebar,modal");
+  },
 };
 
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsListPropertiesCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    window.openDialog("chrome://editor/content/EdListProps.xul","_blank", "chrome,close,titlebar,modal");
-  }
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    window.openDialog("chrome://editor/content/EdListProps.xul", "_blank", "chrome,close,titlebar,modal");
+  },
 };
 
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsPagePropertiesCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     var oldTitle = GetDocumentTitle();
-    window.openDialog("chrome://editor/content/EdPageProps.xul","_blank", "chrome,close,titlebar,modal", "");
+    window.openDialog("chrome://editor/content/EdPageProps.xul", "_blank", "chrome,close,titlebar,modal", "");
 
     // Update main window title and
     // recent menu data in prefs if doc title changed
     if (GetDocumentTitle() != oldTitle)
       UpdateWindowTitle();
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsObjectPropertiesCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     var isEnabled = false;
-    if (IsDocumentEditable() && IsEditingRenderedHTML())
-    {
+    if (IsDocumentEditable() && IsEditingRenderedHTML()) {
       isEnabled = (GetObjectForProperties() != null ||
                    GetCurrentEditor().getSelectedElement("href") != null);
     }
     return isEnabled;
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // Launch Object properties for appropriate selected element
     var element = GetObjectForProperties();
-    if (element)
-    {
+    if (element) {
       var name = element.nodeName.toLowerCase();
-      switch (name)
-      {
-        case 'img':
+      switch (name) {
+        case "img":
           goDoCommand("cmd_image");
           break;
-        case 'hr':
+        case "hr":
           goDoCommand("cmd_hline");
           break;
-        case 'form':
+        case "form":
           goDoCommand("cmd_form");
           break;
-        case 'input':
+        case "input":
           var type = element.getAttribute("type");
           if (type && type.toLowerCase() == "image")
             goDoCommand("cmd_inputimage");
           else
             goDoCommand("cmd_inputtag");
           break;
-        case 'textarea':
+        case "textarea":
           goDoCommand("cmd_textarea");
           break;
-        case 'select':
+        case "select":
           goDoCommand("cmd_select");
           break;
-        case 'button':
+        case "button":
           goDoCommand("cmd_button");
           break;
-        case 'label':
+        case "label":
           goDoCommand("cmd_label");
           break;
-        case 'fieldset':
+        case "fieldset":
           goDoCommand("cmd_fieldset");
           break;
-        case 'table':
+        case "table":
           EditorInsertOrEditTable(false);
           break;
-        case 'td':
-        case 'th':
+        case "td":
+        case "th":
           EditorTableCellProperties();
           break;
-        case 'ol':
-        case 'ul':
-        case 'dl':
-        case 'li':
+        case "ol":
+        case "ul":
+        case "dl":
+        case "li":
           goDoCommand("cmd_listProperties");
           break;
-        case 'a':
-          if (element.name)
-          {
+        case "a":
+          if (element.name) {
             goDoCommand("cmd_anchor");
-          }
-          else if (element.href)
-          {
+          } else if (element.href) {
             goDoCommand("cmd_link");
           }
           break;
-        case 'math':
+        case "math":
           goDoCommand("cmd_insertMathWithDialog");
           break;
         default:
           doAdvancedProperties(element);
           break;
       }
     } else {
       // We get a partially-selected link if asked for specifically
       try {
         element = GetCurrentEditor().getSelectedElement("href");
       } catch (e) {}
       if (element)
         goDoCommand("cmd_link");
     }
-  }
+  },
 };
 
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsSetSmiley =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {
     var smileyCode = aParams.getStringValue("state_attribute");
 
     var strSml;
-    switch(smileyCode)
-    {
-        case ":-)": strSml="s1";
+    switch (smileyCode) {
+        case ":-)": strSml = "s1";
         break;
-        case ":-(": strSml="s2";
+        case ":-(": strSml = "s2";
         break;
-        case ";-)": strSml="s3";
+        case ";-)": strSml = "s3";
         break;
         case ":-P":
         case ":-p":
-        case ":-b": strSml="s4";
+        case ":-b": strSml = "s4";
         break;
-        case ":-D": strSml="s5";
+        case ":-D": strSml = "s5";
         break;
-        case ":-[": strSml="s6";
+        case ":-[": strSml = "s6";
         break;
         case ":-/":
         case ":/":
         case ":-\\":
-        case ":\\": strSml="s7";
+        case ":\\": strSml = "s7";
         break;
         case "=-O":
-        case "=-o": strSml="s8";
+        case "=-o": strSml = "s8";
         break;
-        case ":-*": strSml="s9";
+        case ":-*": strSml = "s9";
         break;
         case ">:o":
-        case ">:-o": strSml="s10";
+        case ">:-o": strSml = "s10";
         break;
-        case "8-)": strSml="s11";
+        case "8-)": strSml = "s11";
         break;
-        case ":-$": strSml="s12";
+        case ":-$": strSml = "s12";
         break;
-        case ":-!": strSml="s13";
+        case ":-!": strSml = "s13";
         break;
         case "O:-)":
-        case "o:-)": strSml="s14";
+        case "o:-)": strSml = "s14";
         break;
-        case ":'(": strSml="s15";
+        case ":'(": strSml = "s15";
         break;
         case ":-X":
-        case ":-x": strSml="s16";
+        case ":-x": strSml = "s16";
         break;
-        default: strSml="";
+        default: strSml = "";
         break;
     }
 
-    try
-    {
+    try {
       var editor = GetCurrentEditor();
       var selection = editor.selection;
       var extElement = editor.createElementWithDefaults("span");
       extElement.setAttribute("class", "moz-smiley-" + strSml);
 
       var intElement = editor.createElementWithDefaults("span");
       if (!intElement)
         return;
 
       var txtElement =  editor.document.createTextNode(smileyCode);
       if (!txtElement)
         return;
 
-      intElement.appendChild (txtElement);
-      extElement.appendChild (intElement);
-
-
-      editor.insertElementAtSelection(extElement,true);
+      intElement.appendChild(txtElement);
+      extElement.appendChild(intElement);
+
+
+      editor.insertElementAtSelection(extElement, true);
       window.content.focus();
-
-    }
-    catch (e)
-    {
+    } catch (e) {
         dump("Exception occurred in smiley InsertElementAtSelection\n");
     }
   },
   // This is now deprecated in favor of "doCommandParams"
-  doCommand: function(aCommand) {}
+  doCommand(aCommand) {},
 };
 
 
-function doAdvancedProperties(element)
-{
-  if (element)
-  {
+function doAdvancedProperties(element) {
+  if (element) {
     window.openDialog("chrome://editor/content/EdAdvancedEdit.xul", "_blank", "chrome,close,titlebar,modal,resizable=yes", "", element);
   }
 }
 
 var nsAdvancedPropertiesCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // Launch AdvancedEdit dialog for the selected element
     try {
       var element = GetCurrentEditor().getSelectedElement("");
       doAdvancedProperties(element);
     } catch (e) {}
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsColorPropertiesCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    window.openDialog("chrome://editor/content/EdColorProps.xul","_blank", "chrome,close,titlebar,modal", "");
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    window.openDialog("chrome://editor/content/EdColorProps.xul", "_blank", "chrome,close,titlebar,modal", "");
     UpdateDefaultColors();
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsIncreaseFontCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     if (!(IsDocumentEditable() && IsEditingRenderedHTML()))
       return false;
     var setIndex = getFontSizeIndex();
     return (setIndex >= 0 && setIndex < 5);
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     var setIndex = getFontSizeIndex();
     if (setIndex < 0 || setIndex >= 5)
       return;
-    var sizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' ];
-    EditorSetFontSize(sizes[setIndex+1]);
-  }
+    var sizes = ["x-small", "small", "medium", "large", "x-large", "xx-large" ];
+    EditorSetFontSize(sizes[setIndex + 1]);
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsDecreaseFontCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     if (!(IsDocumentEditable() && IsEditingRenderedHTML()))
       return false;
     var setIndex = getFontSizeIndex();
     return (setIndex > 0);
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     var setIndex = getFontSizeIndex();
     if (setIndex <= 0)
       return;
-    var sizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' ];
-    EditorSetFontSize(sizes[setIndex-1]);
-  }
+    var sizes = ["x-small", "small", "medium", "large", "x-large", "xx-large" ];
+    EditorSetFontSize(sizes[setIndex - 1]);
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsRemoveNamedAnchorsCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     // We could see if there's any link in selection, but it doesn't seem worth the work!
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     EditorRemoveTextProperty("name", "");
     window.content.focus();
-  }
+  },
 };
 
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsEditLinkCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     // Not really used -- this command is only in context menu, and we do enabling there
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       var element = GetCurrentEditor().getSelectedElement("href");
       if (element)
         editPage(element.href);
     } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsNormalModeCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsHTMLEditor() && IsDocumentEditable();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     SetEditMode(kDisplayModeNormal);
-  }
+  },
 };
 
 var nsAllTagsModeCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsHTMLEditor());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     SetEditMode(kDisplayModeAllTags);
-  }
+  },
 };
 
 var nsHTMLSourceModeCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsHTMLEditor());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     SetEditMode(kDisplayModeSource);
-  }
+  },
 };
 
 var nsPreviewModeCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsHTMLEditor());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     SetEditMode(kDisplayModePreview);
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsInsertOrEditTableCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     if (IsInTableCell())
       EditorTableCellProperties();
     else
       EditorInsertOrEditTable(true);
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsEditTableCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTable();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     EditorInsertOrEditTable(false);
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsSelectTableCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTable();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().selectTable();
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 var nsSelectTableRowCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().selectTableRow();
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 var nsSelectTableColumnCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().selectTableColumn();
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 var nsSelectTableCellCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().selectTableCell();
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 var nsSelectAllTableCellsCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTable();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().selectAllTableCells();
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsInsertTableCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     EditorInsertTable();
-  }
+  },
 };
 
 var nsInsertTableRowAboveCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().insertTableRow(1, false);
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 var nsInsertTableRowBelowCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().insertTableRow(1, true);
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 var nsInsertTableColumnBeforeCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().insertTableColumn(1, false);
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 var nsInsertTableColumnAfterCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().insertTableColumn(1, true);
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 var nsInsertTableCellBeforeCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().insertTableCell(1, false);
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 var nsInsertTableCellAfterCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().insertTableCell(1, true);
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsDeleteTableCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTable();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().deleteTable();
-    } catch(e) {}
+    } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 var nsDeleteTableRowCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     var rows = GetNumberOfContiguousSelectedRows();
     // Delete at least one row
     if (rows == 0)
       rows = 1;
 
     try {
       var editor = GetCurrentTableEditor();
       editor.beginTransaction();
 
       // Loop to delete all blocks of contiguous, selected rows
-      while (rows)
-      {
+      while (rows) {
         editor.deleteTableRow(rows);
         rows = GetNumberOfContiguousSelectedRows();
       }
     } finally { editor.endTransaction(); }
     window.content.focus();
-  }
+  },
 };
 
 var nsDeleteTableColumnCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     var columns = GetNumberOfContiguousSelectedColumns();
     // Delete at least one column
     if (columns == 0)
       columns = 1;
 
     try {
       var editor = GetCurrentTableEditor();
       editor.beginTransaction();
 
       // Loop to delete all blocks of contiguous, selected columns
-      while (columns)
-      {
+      while (columns) {
         editor.deleteTableColumn(columns);
         columns = GetNumberOfContiguousSelectedColumns();
       }
     } finally { editor.endTransaction(); }
     window.content.focus();
-  }
+  },
 };
 
 var nsDeleteTableCellCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().deleteTableCell(1);
     } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 var nsDeleteTableCellContentsCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTableCell();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().deleteTableCellContents();
     } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsNormalizeTableCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTable();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // Use nullptr to let editor find table enclosing current selection
     try {
       GetCurrentTableEditor().normalizeTable(null);
     } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsJoinTableCellsCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
-    if (IsDocumentEditable() && IsEditingRenderedHTML())
-    {
+  isCommandEnabled(aCommand, dummy) {
+    if (IsDocumentEditable() && IsEditingRenderedHTML()) {
       try {
         var editor = GetCurrentTableEditor();
         var tagNameObj = { value: "" };
         var countObj = { value: 0 };
         var cell = editor.getSelectedOrParentTableElement(tagNameObj, countObj);
 
         // We need a cell and either > 1 selected cell or a cell to the right
         //  (this cell may originate in a row spanned from above current row)
         // Note that editor returns "td" for "th" also.
         // (this is a pain! Editor and gecko use lowercase tagNames, JS uses uppercase!)
-        if (cell && (tagNameObj.value == "td"))
-        {
+        if (cell && (tagNameObj.value == "td")) {
           // Selected cells
           if (countObj.value > 1) return true;
 
           var colSpan = cell.getAttribute("colspan");
 
           // getAttribute returns string, we need number
           // no attribute means colspan = 1
           if (!colSpan)
@@ -3710,185 +3352,166 @@ var nsJoinTableCellsCommand =
           return (colSpan && editor.getCellAt(null, rowObj.value,
                                               colObj.value + colSpan));
         }
       } catch (e) {}
     }
     return false;
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // Param: Don't merge non-contiguous cells
     try {
       GetCurrentTableEditor().joinTableCells(false);
     } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsSplitTableCellCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
-    if (IsDocumentEditable() && IsEditingRenderedHTML())
-    {
+  isCommandEnabled(aCommand, dummy) {
+    if (IsDocumentEditable() && IsEditingRenderedHTML()) {
       var tagNameObj = { value: "" };
       var countObj = { value: 0 };
       var cell;
       try {
         cell = GetCurrentTableEditor().getSelectedOrParentTableElement(tagNameObj, countObj);
       } catch (e) {}
 
       // We need a cell parent and there's just 1 selected cell
       // or selection is entirely inside 1 cell
-      if ( cell && (tagNameObj.value == "td") &&
+      if (cell && (tagNameObj.value == "td") &&
            countObj.value <= 1 &&
-           IsSelectionInOneCell() )
-      {
+           IsSelectionInOneCell()) {
         var colSpan = cell.getAttribute("colspan");
         var rowSpan = cell.getAttribute("rowspan");
         if (!colSpan) colSpan = 1;
         if (!rowSpan) rowSpan = 1;
-        return (colSpan > 1  || rowSpan > 1 ||
+        return (colSpan > 1 || rowSpan > 1 ||
                 colSpan == 0 || rowSpan == 0);
       }
     }
     return false;
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     try {
       GetCurrentTableEditor().splitTableCell();
     } catch (e) {}
     window.content.focus();
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsTableOrCellColorCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return IsInTable();
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     EditorSelectColor("TableOrCell");
-  }
+  },
 };
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 var nsPreferencesCommand =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return true;
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    goPreferences('composer_pane');
-  }
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    goPreferences("composer_pane");
+  },
 };
 
 
 var nsFinishHTMLSource =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return true;
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // In editor.js
     SetEditMode(gPreviousNonSourceDisplayMode);
-  }
+  },
 };
 
 var nsCancelHTMLSource =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
+  isCommandEnabled(aCommand, dummy) {
     return true;
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
     // In editor.js
     CancelHTMLSource();
-  }
+  },
 };
 
 var nsConvertToTable =
 {
-  isCommandEnabled: function(aCommand, dummy)
-  {
-    if (IsDocumentEditable() && IsEditingRenderedHTML())
-    {
+  isCommandEnabled(aCommand, dummy) {
+    if (IsDocumentEditable() && IsEditingRenderedHTML()) {
       var selection;
       try {
         selection = GetCurrentEditor().selection;
       } catch (e) {}
 
-      if (selection && !selection.isCollapsed)
-      {
+      if (selection && !selection.isCollapsed) {
         // Don't allow if table or cell is the selection
         var element;
         try {
           element = GetCurrentEditor().getSelectedElement("");
         } catch (e) {}
-        if (element)
-        {
+        if (element) {
           var name = element.nodeName.toLowerCase();
           if (name == "td" ||
               name == "th" ||
               name == "caption" ||
               name == "table")
             return false;
         }
 
         // Selection start and end must be in the same cell
         //   in same cell or both are NOT in a cell
-        if ( GetParentTableCell(selection.focusNode) !=
-             GetParentTableCell(selection.anchorNode) )
-          return false
+        if (GetParentTableCell(selection.focusNode) !=
+             GetParentTableCell(selection.anchorNode))
+          return false;
 
         return true;
       }
     }
     return false;
   },
 
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    if (this.isCommandEnabled())
-    {
-      window.openDialog("chrome://editor/content/EdConvertToTable.xul","_blank", "chrome,close,titlebar,modal")
+  getCommandStateParams(aCommand, aParams, aRefCon) {},
+  doCommandParams(aCommand, aParams, aRefCon) {},
+
+  doCommand(aCommand) {
+    if (this.isCommandEnabled()) {
+      window.openDialog("chrome://editor/content/EdConvertToTable.xul", "_blank", "chrome,close,titlebar,modal");
     }
-  }
+  },
 };
 
--- a/editor/ui/composer/content/editor.js
+++ b/editor/ui/composer/content/editor.js
@@ -33,33 +33,33 @@ var gDocWasModified = false;  // Check i
 var gContentWindow = 0;
 var gSourceContentWindow = 0;
 var gSourceTextEditor = null;
 var gContentWindowDeck;
 var gFormatToolbar;
 var gFormatToolbarHidden = false;
 var gViewFormatToolbar;
 var gChromeState;
-var gColorObj = { LastTextColor:"", LastBackgroundColor:"", LastHighlightColor:"",
-                  Type:"", SelectedType:"", NoDefault:false, Cancel:false,
-                  HighlightColor:"", BackgroundColor:"", PageColor:"",
-                  TextColor:"", TableColor:"", CellColor:""
+var gColorObj = { LastTextColor: "", LastBackgroundColor: "", LastHighlightColor: "",
+                  Type: "", SelectedType: "", NoDefault: false, Cancel: false,
+                  HighlightColor: "", BackgroundColor: "", PageColor: "",
+                  TextColor: "", TableColor: "", CellColor: "",
                 };
 var gDefaultTextColor = "";
 var gDefaultBackgroundColor = "";
 var gCSSPrefListener;
 var gEditorToolbarPrefListener;
 var gReturnInParagraphPrefListener;
 var gLocalFonts = null;
 
 var gLastFocusNode = null;
 var gLastFocusNodeWasSelected = false;
 
 // These must be kept in synch with the XUL <options> lists
-var gFontSizeNames = ["xx-small","x-small","small","medium","large","x-large","xx-large"];
+var gFontSizeNames = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"];
 
 var nsIFilePicker = Ci.nsIFilePicker;
 
 var kEditorToolbarPrefs = "editor.toolbars.showbutton.";
 var kUseCssPref         = "editor.use_css";
 var kCRInParagraphsPref = "editor.CR_creates_new_p";
 
 function ShowHideToolbarSeparators(toolbar) {
@@ -78,196 +78,177 @@ function ShowHideToolbarSeparators(toolb
       if (separator)
         separator.hidden = hideSeparator;
       separator = null;
       hideSeparator = false;
     }
   }
 }
 
-function ShowHideToolbarButtons()
-{
+function ShowHideToolbarButtons() {
   let array = Services.prefs.getChildList(kEditorToolbarPrefs);
   for (let i in array) {
     let prefName = array[i];
     let id = prefName.substr(kEditorToolbarPrefs.length);
     let button = document.getElementById(id + "Button") ||
                  document.getElementById(id + "-button");
     if (button)
       button.hidden = !Services.prefs.getBoolPref(prefName);
   }
   ShowHideToolbarSeparators(document.getElementById("EditToolbar"));
   ShowHideToolbarSeparators(document.getElementById("FormatToolbar"));
 }
 
-function nsPrefListener(prefName)
-{
+function nsPrefListener(prefName) {
   this.startup(prefName);
 }
 
 // implements nsIObserver
 nsPrefListener.prototype =
 {
   domain: "",
-  startup: function(prefName)
-  {
+  startup(prefName) {
     this.domain = prefName;
     try {
       Services.prefs.addObserver(this.domain, this);
-    } catch(ex) {
+    } catch (ex) {
       dump("Failed to observe prefs: " + ex + "\n");
     }
   },
-  shutdown: function()
-  {
+  shutdown() {
     try {
       Services.prefs.removeObserver(this.domain, this);
-    } catch(ex) {
+    } catch (ex) {
       dump("Failed to remove pref observers: " + ex + "\n");
     }
   },
-  observe: function(subject, topic, prefName)
-  {
+  observe(subject, topic, prefName) {
     if (!IsHTMLEditor())
       return;
     // verify that we're changing a button pref
     if (topic != "nsPref:changed")
       return;
 
     let editor = GetCurrentEditor();
-    if (prefName == kUseCssPref)
-    {
+    if (prefName == kUseCssPref) {
       let cmd = document.getElementById("cmd_highlight");
       if (cmd) {
         let useCSS = Services.prefs.getBoolPref(prefName);
 
         if (useCSS && editor) {
           let mixedObj = {};
           let state = editor.getHighlightColorState(mixedObj);
           cmd.setAttribute("state", state);
           cmd.collapsed = false;
-        }
-        else {
+        } else {
           cmd.setAttribute("state", "transparent");
           cmd.collapsed = true;
         }
 
         if (editor)
           editor.isCSSEnabled = useCSS;
       }
-    }
-    else if (prefName.startsWith(kEditorToolbarPrefs))
-    {
+    } else if (prefName.startsWith(kEditorToolbarPrefs)) {
       let id = prefName.substr(kEditorToolbarPrefs.length) + "Button";
       let button = document.getElementById(id);
       if (button) {
         button.hidden = !Services.prefs.getBoolPref(prefName);
         ShowHideToolbarSeparators(button.parentNode);
       }
-    }
-    else if (editor && (prefName == kCRInParagraphsPref))
+    } else if (editor && (prefName == kCRInParagraphsPref))
       editor.returnInParagraphCreatesNewParagraph = Services.prefs.getBoolPref(prefName);
-  }
-}
+  },
+};
 
 const gSourceTextListener =
 {
   NotifyDocumentCreated: function NotifyDocumentCreated() {},
   NotifyDocumentWillBeDestroyed: function NotifyDocumentWillBeDestroyed() {},
-  NotifyDocumentStateChanged: function NotifyDocumentStateChanged(isChanged)
-  {
+  NotifyDocumentStateChanged: function NotifyDocumentStateChanged(isChanged) {
     window.updateCommands("save");
-  }
+  },
 };
 
 const gSourceTextObserver =
 {
-  observe: function observe(aSubject, aTopic, aData)
-  {
+  observe: function observe(aSubject, aTopic, aData) {
     // we currently only use this to update undo
     window.updateCommands("undo");
-  }
+  },
 };
 
 // This should be called by all editor users when they close their window.
-function EditorCleanup()
-{
+function EditorCleanup() {
   SwitchInsertCharToAnotherEditorOrClose();
 }
 
 var DocumentReloadListener =
 {
-  NotifyDocumentCreated: function() {},
-  NotifyDocumentWillBeDestroyed: function() {},
-
-  NotifyDocumentStateChanged:function( isNowDirty )
-  {
+  NotifyDocumentCreated() {},
+  NotifyDocumentWillBeDestroyed() {},
+
+  NotifyDocumentStateChanged(isNowDirty) {
     var editor = GetCurrentEditor();
     try {
       // unregister the listener to prevent multiple callbacks
-      editor.removeDocumentStateListener( DocumentReloadListener );
+      editor.removeDocumentStateListener(DocumentReloadListener);
 
       var charset = editor.documentCharacterSet;
 
       // update the META charset with the current presentation charset
       editor.documentCharacterSet = charset;
-
     } catch (e) {}
-  }
+  },
 };
 
 // implements nsIObserver
 var gEditorDocumentObserver =
 {
-  observe: function(aSubject, aTopic, aData)
-  {
+  observe(aSubject, aTopic, aData) {
     // Should we allow this even if NOT the focused editor?
     var commandManager = GetCurrentCommandManager();
     if (commandManager != aSubject)
       return;
 
     var editor = GetCurrentEditor();
-    switch(aTopic)
-    {
+    switch (aTopic) {
       case "obs_documentCreated":
         // Just for convenience
         gContentWindow = window.content;
 
         // Get state to see if document creation succeeded
         var params = newCommandParams();
         if (!params)
           return;
 
         try {
           commandManager.getCommandState(aTopic, gContentWindow, params);
           var errorStringId = 0;
           var editorStatus = params.getLongValue("state_data");
-          if (!editor && editorStatus == nsIEditingSession.eEditorOK)
-          {
+          if (!editor && editorStatus == nsIEditingSession.eEditorOK) {
             dump("\n ****** NO EDITOR BUT NO EDITOR ERROR REPORTED ******* \n\n");
             editorStatus = nsIEditingSession.eEditorErrorUnknown;
           }
 
-          switch (editorStatus)
-          {
+          switch (editorStatus) {
             case nsIEditingSession.eEditorErrorCantEditFramesets:
               errorStringId = "CantEditFramesetMsg";
               break;
             case nsIEditingSession.eEditorErrorCantEditMimeType:
               errorStringId = "CantEditMimeTypeMsg";
               break;
             case nsIEditingSession.eEditorErrorUnknown:
               errorStringId = "CantEditDocumentMsg";
               break;
             // Note that for "eEditorErrorFileNotFound,
             // network code popped up an alert dialog, so we don't need to
           }
           if (errorStringId)
             Services.prompt.alert(window, "", GetString(errorStringId));
-        } catch(e) { dump("EXCEPTION GETTING obs_documentCreated state "+e+"\n"); }
+        } catch (e) { dump("EXCEPTION GETTING obs_documentCreated state " + e + "\n"); }
 
         // We have a bad editor -- nsIEditingSession will rebuild an editor
         //   with a blank page, so simply abort here
         if (editorStatus)
           return;
 
         if (!("InsertCharWindow" in window))
           window.InsertCharWindow = null;
@@ -279,20 +260,19 @@ var gEditorDocumentObserver =
           editor.addOverrideStyleSheet(kNormalStyleSheet);
 
           // remove contenteditable stylesheets if they were applied by the
           // editingSession
           editor.removeOverrideStyleSheet(kContentEditableStyleSheet);
         } catch (e) {}
 
         // Things for just the Web Composer application
-        if (IsWebComposer())
-        {
+        if (IsWebComposer()) {
           InlineSpellCheckerUI.init(editor);
-          document.getElementById('menu_inlineSpellCheck').setAttribute('disabled', !InlineSpellCheckerUI.canSpellCheck);
+          document.getElementById("menu_inlineSpellCheck").setAttribute("disabled", !InlineSpellCheckerUI.canSpellCheck);
 
           editor.returnInParagraphCreatesNewParagraph = Services.prefs.getBoolPref(kCRInParagraphsPref);
 
           // Set focus to content window if not a mail composer
           // Race conditions prevent us from setting focus here
           //   when loading a url into blank window
           setTimeout(SetFocusOnStartup, 0);
 
@@ -300,21 +280,20 @@ var gEditorDocumentObserver =
           editor.enableUndo(false);
           EditorSetDefaultPrefsAndDoctype();
           editor.resetModificationCount();
           editor.enableUndo(true);
 
           // We may load a text document into an html editor,
           //   so be sure editortype is set correctly
           // XXX We really should use the "real" plaintext editor for this!
-          if (editor.contentsMIMEType == "text/plain")
-          {
+          if (editor.contentsMIMEType == "text/plain") {
             try {
               GetCurrentEditorElement().editortype = "text";
-            } catch (e) { dump (e)+"\n"; }
+            } catch (e) { dump(e) + "\n"; }
 
             // Hide or disable UI not used for plaintext editing
             HideItem("FormatToolbar");
             HideItem("EditModeToolbar");
             HideItem("formatMenu");
             HideItem("tableMenu");
             HideItem("menu_validate");
             HideItem("sep_validate");
@@ -357,18 +336,17 @@ var gEditorDocumentObserver =
           // (Windows may load with local file paths)
           SetSaveAndPublishUI(GetDocumentUrl());
 
           // Start in "Normal" edit mode
           SetDisplayMode(kDisplayModeNormal);
         }
 
         // Add mouse click watcher if right type of editor
-        if (IsHTMLEditor())
-        {
+        if (IsHTMLEditor()) {
           // Force color widgets to update
           onFontColorChange();
           onBackgroundColorChange();
         }
         break;
 
       case "cmd_setDocumentModified":
         window.updateCommands("save");
@@ -379,50 +357,47 @@ var gEditorDocumentObserver =
         break;
 
       case "obs_documentLocationChanged":
         // Ignore this when editor doesn't exist,
         //   which happens once when page load starts
         if (editor)
           try {
             editor.updateBaseURL();
-          } catch(e) { dump (e); }
+          } catch (e) { dump(e); }
         break;
 
       case "cmd_bold":
         // Update all style items
         // cmd_bold is a proxy; see EditorSharedStartup (above) for details
         window.updateCommands("style");
         window.updateCommands("undo");
         break;
     }
-  }
-}
-
-function SetFocusOnStartup()
-{
+  },
+};
+
+function SetFocusOnStartup() {
   gContentWindow.focus();
 }
 
-function EditorLoadUrl(url)
-{
+function EditorLoadUrl(url) {
   try {
     if (url) {
       let loadURIOptions = {
         loadFlags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE,
-        triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()
+        triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
       };
       GetCurrentEditorElement().webNavigation.loadURI(url, loadURIOptions);
     }
-  } catch (e) { dump(" EditorLoadUrl failed: "+e+"\n"); }
+  } catch (e) { dump(" EditorLoadUrl failed: " + e + "\n"); }
 }
 
 // This should be called by all Composer types
-function EditorSharedStartup()
-{
+function EditorSharedStartup() {
   // Just for convenience
   gContentWindow = window.content;
 
   // Disable DNS Prefetching on the docshell - we don't need it for composer
   // type windows.
   GetCurrentEditorElement().docShell.allowDNSPrefetch = false;
 
   // Set up the mime type and register the commands.
@@ -447,18 +422,18 @@ function EditorSharedStartup()
     commandManager.addCommandObserver(gEditorDocumentObserver, "cmd_bold");
   } catch (e) { dump(e); }
 
   var isMac = AppConstants.platform == "macosx";
 
   // Set platform-specific hints for how to select cells
   // Mac uses "Cmd", all others use "Ctrl"
   var tableKey = GetString(isMac ? "XulKeyMac" : "TableSelectKey");
-  var dragStr = tableKey+GetString("Drag");
-  var clickStr = tableKey+GetString("Click");
+  var dragStr = tableKey + GetString("Drag");
+  var clickStr = tableKey + GetString("Click");
 
   var delStr = GetString(isMac ? "Clear" : "Del");
 
   SafeSetAttribute("menu_SelectCell", "acceltext", clickStr);
   SafeSetAttribute("menu_SelectRow", "acceltext", dragStr);
   SafeSetAttribute("menu_SelectColumn", "acceltext", dragStr);
   SafeSetAttribute("menu_SelectAllCells", "acceltext", dragStr);
   // And add "Del" or "Clear"
@@ -466,53 +441,49 @@ function EditorSharedStartup()
 
   // Set text for indent, outdent keybinding
 
   // hide UI that we don't have components for
   RemoveInapplicableUIElements();
 
   // Use browser colors as initial values for editor's default colors
   var BrowserColors = GetDefaultBrowserColors();
-  if (BrowserColors)
-  {
+  if (BrowserColors) {
     gDefaultTextColor = BrowserColors.TextColor;
     gDefaultBackgroundColor = BrowserColors.BackgroundColor;
   }
 
   // For new window, no default last-picked colors
   gColorObj.LastTextColor = "";
   gColorObj.LastBackgroundColor = "";
   gColorObj.LastHighlightColor = "";
 }
 
-function SafeSetAttribute(nodeID, attributeName, attributeValue)
-{
+function SafeSetAttribute(nodeID, attributeName, attributeValue) {
     var theNode = document.getElementById(nodeID);
     if (theNode)
         theNode.setAttribute(attributeName, attributeValue);
 }
 
-function DocumentHasBeenSaved()
-{
+function DocumentHasBeenSaved() {
   var fileurl = "";
   try {
     fileurl = GetDocumentUrl();
   } catch (e) {
     return false;
   }
 
   if (!fileurl || IsUrlAboutBlank(fileurl))
     return false;
 
   // We have a file URL already
   return true;
 }
 
-async function CheckAndSaveDocument(command, allowDontSave)
-{
+async function CheckAndSaveDocument(command, allowDontSave) {
   var document;
   try {
     // if we don't have an editor or an document, bail
     var editor = GetCurrentEditor();
     document = editor.document;
     if (!document)
       return true;
   } catch (e) { return true; }
@@ -523,18 +494,17 @@ async function CheckAndSaveDocument(comm
   // call window.focus, since we need to pop up a dialog
   // and therefore need to be visible (to prevent user confusion)
   top.document.commandDispatcher.focusedWindow.focus();
 
   var scheme = GetScheme(GetDocumentUrl());
   var doPublish = (scheme && scheme != "file");
 
   var strID;
-  switch (command)
-  {
+  switch (command) {
     case "cmd_close":
       strID = "BeforeClosing";
       break;
     case "cmd_preview":
       strID = "BeforePreview";
       break;
     case "cmd_editSendPage":
       strID = "SendPageReason";
@@ -545,49 +515,44 @@ async function CheckAndSaveDocument(comm
   }
 
   var reasonToSave = strID ? GetString(strID) : "";
 
   var title = document.title || GetString("untitledDefaultFilename");
 
   var dialogTitle = GetString(doPublish ? "PublishPage" : "SaveDocument");
   var dialogMsg = GetString(doPublish ? "PublishPrompt" : "SaveFilePrompt");
-  dialogMsg = (dialogMsg.replace(/%title%/,title)).replace(/%reason%/,reasonToSave);
-
-  let result = {value:0};
+  dialogMsg = (dialogMsg.replace(/%title%/, title)).replace(/%reason%/, reasonToSave);
+
+  let result = {value: 0};
   let promptFlags = Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1;
   let button1Title = null;
   let button3Title = null;
 
-  if (doPublish)
-  {
+  if (doPublish) {
     promptFlags += Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0;
     button1Title = GetString("Publish");
     button3Title = GetString("DontPublish");
-  }
-  else
-  {
+  } else {
     promptFlags += Services.prompt.BUTTON_TITLE_SAVE * Services.prompt.BUTTON_POS_0;
   }
 
   // If allowing "Don't..." button, add that
   if (allowDontSave)
     promptFlags += doPublish ?
         (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_2)
         : (Services.prompt.BUTTON_TITLE_DONT_SAVE * Services.prompt.BUTTON_POS_2);
 
   result = Services.prompt.confirmEx(window, dialogTitle, dialogMsg, promptFlags,
-                          button1Title, null, button3Title, null, {value:0});
-
-  if (result == 0)
-  {
+                          button1Title, null, button3Title, null, {value: 0});
+
+  if (result == 0) {
     // Save, but first finish HTML source mode
     SetEditMode(gPreviousNonSourceDisplayMode);
-    if (doPublish)
-    {
+    if (doPublish) {
       // We save the command the user wanted to do in a global
       // and return as if user canceled because publishing is asynchronous
       // This command will be fired when publishing finishes
       gCommandAfterPublishing = command;
       goDoCommand("cmd_publish");
       return false;
     }
 
@@ -599,92 +564,83 @@ async function CheckAndSaveDocument(comm
     return true;
 
   // Default or result == 1 (Cancel)
   return false;
 }
 
 // --------------------------- View menu ---------------------------
 
-function EditorSetCharacterSet(aEvent)
-{
+function EditorSetCharacterSet(aEvent) {
   try {
     var editor = GetCurrentEditor();
     if (aEvent.target.hasAttribute("charset"))
       editor.documentCharacterSet = aEvent.target.getAttribute("charset");
     var docUrl = GetDocumentUrl();
-    if( !IsUrlAboutBlank(docUrl))
-    {
+    if (!IsUrlAboutBlank(docUrl)) {
       // reloading the document will reverse any changes to the META charset,
       // we need to put them back in, which is achieved by a dedicated listener
-      editor.addDocumentStateListener( DocumentReloadListener );
+      editor.addDocumentStateListener(DocumentReloadListener);
       EditorLoadUrl(docUrl);
     }
   } catch (e) {}
 }
 
 // --------------------------- Text style ---------------------------
 
-function onParagraphFormatChange(paraMenuList, commandID)
-{
+function onParagraphFormatChange(paraMenuList, commandID) {
   if (!paraMenuList)
     return;
 
   var commandNode = document.getElementById(commandID);
   var state = commandNode.getAttribute("state");
 
   // force match with "normal"
   if (state == "body")
     state = "";
 
-  if (state == "mixed")
-  {
-    //Selection is the "mixed" ( > 1 style) state
+  if (state == "mixed") {
+    // Selection is the "mixed" ( > 1 style) state
     paraMenuList.selectedItem = null;
-    paraMenuList.setAttribute("label",GetString('Mixed'));
-  }
-  else
-  {
+    paraMenuList.setAttribute("label", GetString("Mixed"));
+  } else {
     var menuPopup = document.getElementById("ParagraphPopup");
     var menuItems = menuPopup.childNodes;
-    for (var i=0; i < menuItems.length; i++)
-    {
+    for (var i = 0; i < menuItems.length; i++) {
       var menuItem = menuItems.item(i);
-      if ("value" in menuItem && menuItem.value == state)
-      {
+      if ("value" in menuItem && menuItem.value == state) {
         paraMenuList.selectedItem = menuItem;
         break;
       }
     }
   }
 }
 
 /**
  * Selects the current font face in the menulist.
  *
  * @param fontFaceMenuList  The menulist element containing the list of fonts.
  * @param commandID         The commandID which holds the current font name
  *                          in its "state" attribute.
  */
-function onFontFaceChange(fontFaceMenuList, commandID)
-{
+function onFontFaceChange(fontFaceMenuList, commandID) {
   var commandNode = document.getElementById(commandID);
   var editorFont = commandNode.getAttribute("state");
 
   // Strip quotes in font names. Experiments have shown that we only
   // ever get double quotes around the font name, never single quotes,
   // even if they were in the HTML source. Also single or double
   // quotes within the font name are never returned.
   editorFont = editorFont.replace(/"/g, "");
 
   switch (editorFont) {
   case "mixed":
     // Selection is the "mixed" ( > 1 style) state.
     fontFaceMenuList.selectedItem = null;
-    fontFaceMenuList.setAttribute("label",GetString('Mixed'));
+    fontFaceMenuList.setAttribute("label", GetString("Mixed"));
     return;
   case "":
   case "serif":
   case "sans-serif":
     // Generic variable width.
     fontFaceMenuList.selectedIndex = 0;
     return;
   case "tt":
@@ -725,89 +681,75 @@ function onFontFaceChange(fontFaceMenuLi
   let afterUsedFontSection = false;
 
   // The menu items not only have "label" and "value", but also some other attributes:
   // "value_parsed": Is the toLowerCase() and space-stripped value.
   // "value_cache":  Is a concatenation of all editor fonts that were ever mapped
   //                 onto this menu item. This is done for optimization.
   // "used":         This item is in the used font section.
 
-  for (let i = 0; i < menuItems.length; i++)
-  {
+  for (let i = 0; i < menuItems.length; i++) {
     let menuItem = menuItems.item(i);
-    if (menuItem.hasAttribute("label") && menuItem.hasAttribute("value_parsed"))
-    {
+    if (menuItem.hasAttribute("label") && menuItem.hasAttribute("value_parsed")) {
       // The element seems to represent a font <menuitem>.
       let fontMenuValue = menuItem.getAttribute("value_parsed");
       if (fontMenuValue == editorFontToLower ||
           (menuItem.hasAttribute("value_cache") &&
-           menuItem.getAttribute("value_cache").split("|").includes(editorFontToLower)))
-      {
+           menuItem.getAttribute("value_cache").split("|").includes(editorFontToLower))) {
         // This menuitem contains the font we are looking for.
         foundFont = menuItem;
         exactMatch = true;
         break;
-      }
-      else if (editorOptionsCount > 1 && afterUsedFontSection)
-      {
+      } else if (editorOptionsCount > 1 && afterUsedFontSection) {
         // Once we are in the list of all other available fonts,
         // we will find the one that best matches one of the options.
         let matchPos = editorFontOptions.indexOf(fontMenuValue);
-        if (matchPos >= 0 && matchPos < matchedFontIndex)
-        {
+        if (matchPos >= 0 && matchPos < matchedFontIndex) {
           // This menu font comes earlier in the list of options,
           // so prefer it.
           matchedFontIndex = matchPos;
           foundFont = menuItem;
           // If we matched the first option, we don't need to look for
           // a better match.
           if (matchPos == 0)
             break;
         }
       }
-    }
-    else
-    {
+    } else {
       // Some other element type.
-      if (menuItem == usedFontsSep)
-      {
+      if (menuItem == usedFontsSep) {
         // We have now passed the section of used fonts and are now in the list of all.
         afterUsedFontSection = true;
       }
     }
   }
 
-  if (foundFont)
-  {
+  if (foundFont) {
     let defaultFontsSep = menuPopup.querySelector("menuseparator.fontFaceMenuAfterDefaultFonts");
-    if (exactMatch)
-    {
-      if (afterUsedFontSection)
-      {
+    if (exactMatch) {
+      if (afterUsedFontSection) {
         // Copy the matched font into the section of used fonts.
         // We insert after the separator following the default fonts,
         // so right at the beginning of the used fonts section.
         let copyItem = foundFont.cloneNode(true);
         menuPopup.insertBefore(copyItem, defaultFontsSep.nextSibling);
         usedFontsSep.hidden = false;
         foundFont = copyItem;
         foundFont.setAttribute("used", "true");
       }
-    }
-    else
-    {
+    } else {
       // Keep only the found font and generic families in the font string.
       editorFont = editorFont.replace(/, /g, ",").split(",").filter(
         font => ((font.toLowerCase() == foundFont.getAttribute("value_parsed")) ||
                  genericFamilies.includes(font))).join(",");
 
       // Check if such an item is already in the used font section.
       if (afterUsedFontSection)
-        foundFont = menuPopup.querySelector('menuitem[used="true"][value_parsed="'+
-                    editorFont.toLowerCase()+'"]');
+        foundFont = menuPopup.querySelector('menuitem[used="true"][value_parsed="' +
+                    editorFont.toLowerCase() + '"]');
       // If not, create a new entry which will be inserted into that section.
       if (!foundFont)
         foundFont = createFontFaceMenuitem(editorFont, editorFont, menuPopup);
 
       // Add the editor font string into the 'cache' attribute in the element
       // so we can later find it quickly without building the reduced string again.
       let fontCache = "";
       if (foundFont.hasAttribute("value_cache"))
@@ -816,104 +758,88 @@ function onFontFaceChange(fontFaceMenuLi
 
       // If we created a new item, set it up and insert.
       if (!foundFont.hasAttribute("used")) {
         foundFont.setAttribute("used", "true");
         usedFontsSep.hidden = false;
         menuPopup.insertBefore(foundFont, defaultFontsSep.nextSibling);
       }
     }
-  }
-  else
-  {
+  } else {
     // The editor encountered a font that is not installed on this system.
     // Add it to the font menu now, in the used-fonts section right at the
     // bottom before the separator of the section.
     let fontLabel = GetFormattedString("NotInstalled", editorFont);
     foundFont = createFontFaceMenuitem(fontLabel, editorFont, menuPopup);
     foundFont.setAttribute("used", "true");
     usedFontsSep.hidden = false;
     menuPopup.insertBefore(foundFont, usedFontsSep);
   }
   fontFaceMenuList.selectedItem = foundFont;
 }
 
 /**
  * Clears the used fonts list from all the font face menulists.
  */
-function ClearUsedFonts()
-{
+function ClearUsedFonts() {
   let userFontSeps = document.querySelectorAll("menuseparator.fontFaceMenuAfterDefaultFonts");
   for (let userFontSep of userFontSeps) {
     let parentList = userFontSep.parentNode;
     while (true) {
       let nextNode = userFontSep.nextSibling;
       if (nextNode.tagName != "menuseparator") {
         nextNode.remove();
-      } else {
-        if (nextNode.classList.contains("fontFaceMenuAfterUsedFonts")) {
+      } else if (nextNode.classList.contains("fontFaceMenuAfterUsedFonts")) {
           nextNode.hidden = true;
           break;
         }
-      }
     }
   }
 }
 
-function EditorSelectFontSize()
-{
+function EditorSelectFontSize() {
   var select = document.getElementById("FontSizeSelect");
-  if (select)
-  {
+  if (select) {
     if (select.selectedIndex == -1)
       return;
 
     EditorSetFontSize(gFontSizeNames[select.selectedIndex]);
   }
 }
 
-function onFontSizeChange(fontSizeMenulist, commandID)
-{
+function onFontSizeChange(fontSizeMenulist, commandID) {
   // If we don't match anything, set to "0 (normal)"
   var newIndex = 2;
   var size = fontSizeMenulist.getAttribute("size");
-  if ( size == "mixed")
-  {
+  if (size == "mixed") {
     // No single type selected
     newIndex = -1;
-  }
-  else
-  {
-    for (var i = 0; i < gFontSizeNames.length; i++)
-    {
-      if( gFontSizeNames[i] == size )
-      {
+  } else {
+    for (var i = 0; i < gFontSizeNames.length; i++) {
+      if (gFontSizeNames[i] == size) {
         newIndex = i;
         break;
       }
     }
   }
   if (fontSizeMenulist.selectedIndex != newIndex)
     fontSizeMenulist.selectedIndex = newIndex;
 }
 
-function EditorSetFontSize(size)
-{
-  if( size == "0" || size == "normal" ||
-      size == "medium" )
-  {
+function EditorSetFontSize(size) {
+  if (size == "0" || size == "normal" ||
+      size == "medium") {
     EditorRemoveTextProperty("font", "size");
     // Also remove big and small,
     //  else it will seem like size isn't changing correctly
     EditorRemoveTextProperty("small", "");
     EditorRemoveTextProperty("big", "");
   } else {
     // Temp: convert from new CSS size strings to old HTML size strings
-    switch (size)
-    {
+    switch (size) {
       case "xx-small":
       case "x-small":
         size = "-2";
         break;
       case "small":
         size = "-1";
         break;
       case "large":
@@ -926,76 +852,67 @@ function EditorSetFontSize(size)
         size = "+3";
         break;
     }
     EditorSetTextProperty("font", "size", size);
   }
   gContentWindow.focus();
 }
 
-function initFontFaceMenu(menuPopup)
-{
+function initFontFaceMenu(menuPopup) {
   initLocalFontFaceMenu(menuPopup);
 
-  if (menuPopup)
-  {
+  if (menuPopup) {
     var children = menuPopup.childNodes;
     if (!children) return;
 
     var mixed = { value: false };
     var editorFont = GetCurrentEditor().getFontFaceState(mixed);
 
     // Strip quotes in font names. Experiments have shown that we only
     // ever get double quotes around the font name, never single quotes,
     // even if they were in the HTML source. Also single or double
     // quotes within the font name are never returned.
     editorFont = editorFont.replace(/"/g, "");
 
-    if (!mixed.value)
-    {
-      switch (editorFont)
-      {
+    if (!mixed.value) {
+      switch (editorFont) {
       case "":
       case "serif":
       case "sans-serif":
         // Generic variable width.
         editorFont = "";
         break;
       case "tt":
       case "monospace":
         // Generic fixed width.
         editorFont = "tt";
         break;
       default:
         editorFont = editorFont.toLowerCase().replace(/, /g, ","); // bug 1139524
       }
     }
 
-    var editorFontOptions = editorFont.split(',');
+    var editorFontOptions = editorFont.split(",");
     var matchedOption = editorFontOptions.length;  // initialise to high invalid value
-    for (var i = 0; i < children.length; i++)
-    {
+    for (var i = 0; i < children.length; i++) {
       var menuItem = children[i];
-      if (menuItem.localName == "menuitem")
-      {
+      if (menuItem.localName == "menuitem") {
         var matchFound = false;
-        if (!mixed.value)
-        {
+        if (!mixed.value) {
           var menuFont = menuItem.getAttribute("value").toLowerCase().replace(/, /g, ",");
 
           // First compare the entire font string to match items that contain commas.
-          if (menuFont == editorFont)
-          {
+          if (menuFont == editorFont) {
             menuItem.setAttribute("checked", "true");
             break;
           }
 
           // Next compare the individual options.
-          else if (editorFontOptions.length > 1)
-          {
+          else if (editorFontOptions.length > 1) {
             var matchPos = editorFontOptions.indexOf(menuFont);
             if (matchPos >= 0 && matchPos < matchedOption) {
               // This menu font comes earlier in the list of options,
               // so prefer it.
               menuItem.setAttribute("checked", "true");
 
               // If we matched the first option, we don't need to look for
               // a better match.
@@ -1022,82 +939,73 @@ function initFontFaceMenu(menuPopup)
 // ==separator
 // Helvetica, Arial
 // Times
 // Courier
 // ==separator
 // ==separator
 const kFixedFontFaceMenuItems = 8;
 
-function initLocalFontFaceMenu(menuPopup)
-{
-  if (!gLocalFonts)
-  {
+function initLocalFontFaceMenu(menuPopup) {
+  if (!gLocalFonts) {
     // Build list of all local fonts once per editor
-    try
-    {
+    try {
       var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
                          .getService(Ci.nsIFontEnumerator);
-      var localFontCount = { value: 0 }
+      var localFontCount = { value: 0 };
       gLocalFonts = enumerator.EnumerateAllFonts(localFontCount);
-    }
-    catch(e) { }
+    } catch (e) { }
   }
 
   // Don't use radios for menulists.
   let useRadioMenuitems = (menuPopup.parentNode.localName == "menu");
   menuPopup.setAttribute("useRadios", useRadioMenuitems);
-  if (menuPopup.childNodes.length == kFixedFontFaceMenuItems)
-  {
+  if (menuPopup.childNodes.length == kFixedFontFaceMenuItems) {
     if (gLocalFonts.length == 0) {
       menuPopup.querySelector(".fontFaceMenuAfterDefaultFonts").hidden = true;
     }
-    for (let i = 0; i < gLocalFonts.length; ++i)
-    {
+    for (let i = 0; i < gLocalFonts.length; ++i) {
       // Remove Linux system generic fonts that collide with CSS generic fonts.
       if (gLocalFonts[i] != "" &&
           gLocalFonts[i] != "serif" &&
           gLocalFonts[i] != "sans-serif" &&
-          gLocalFonts[i] != "monospace")
-      {
+          gLocalFonts[i] != "monospace") {
         let itemNode = createFontFaceMenuitem(gLocalFonts[i], gLocalFonts[i], menuPopup);
         menuPopup.appendChild(itemNode);
       }
     }
   }
 }
 
 /**
  * Creates a menuitem element for the font faces menulist. Returns the menuitem
  * but does not add it automatically to the menupopup.
  *
  * @param aFontLabel  Label to be displayed for the item.
  * @param aFontName   The font face value to be used for the item.
  *                    Will be used in <font face="value"> in the edited document.
  * @param aMenuPopup  The menupopup for which this menuitem is created.
  */
-function createFontFaceMenuitem(aFontLabel, aFontName, aMenuPopup)
-{
+function createFontFaceMenuitem(aFontLabel, aFontName, aMenuPopup) {
   let itemNode = document.createElementNS(XUL_NS, "menuitem");
   itemNode.setAttribute("label", aFontLabel);
   itemNode.setAttribute("value", aFontName);
   itemNode.setAttribute("value_parsed", aFontName.toLowerCase().replace(/, /g, ","));
   itemNode.setAttribute("tooltiptext", aFontLabel);
   if (aMenuPopup.getAttribute("useRadios") == "true") {
     itemNode.setAttribute("type", "radio");
     itemNode.setAttribute("observes", "cmd_renderedHTMLEnabler");
   }
   return itemNode;
 }
 
 /**
  * Helper function
  */
-function getFontSizeIndex()
-{
+function getFontSizeIndex() {
   var firstHas = { value: false };
   var anyHas = { value: false };
   var allHas = { value: false };
 
   var fontSize = EditorGetTextProperty("font", "size", null, firstHas, anyHas, allHas);
 
   // If the element has no size attribute and no size was found at all,
   // we assume "medium" size. This is highly problematic since
@@ -1107,18 +1015,17 @@ function getFontSizeIndex()
   // imply "medium".
   if (!anyHas.value)
     return 2;
 
   // Mixed selection.
   if (!allHas.value)
     return -1;
 
-  switch (fontSize)
-  {
+  switch (fontSize) {
     case "-3":
     case "-2":
     case "0":
     case "1":
       // x-small.
       return 0;
     case "-1":
     case "2":
@@ -1142,35 +1049,30 @@ function getFontSizeIndex()
       // xx-large.
       return 5;
   }
 
   // We shouldn't get here. All the selection has a value we don't understand.
   return -1;
 }
 
-function initFontSizeMenu(menuPopup, fullMenu)
-{
-  if (menuPopup)
-  {
+function initFontSizeMenu(menuPopup, fullMenu) {
+  if (menuPopup) {
     var children = menuPopup.childNodes;
     if (!children)
       return;
 
     // Fixed size items start after menu separator depending on whether it is
     // a full menu.
     var menuIndex = fullMenu ? 3 : 0;
 
     var setIndex = getFontSizeIndex();
-    if (setIndex >= 0)
-    {
+    if (setIndex >= 0) {
       children[menuIndex + setIndex].setAttribute("checked", true);
-    }
-    else
-    {
+    } else {
       // In case of mixed, clear all items.
       for (var i = menuIndex; i < children.length; i++) {
         children[i].setAttribute("checked", false);
       }
     }
 
     // Some configurations might not have the "small/big" indicator as
     // last item. If there is no indicator, we are done.
@@ -1187,470 +1089,400 @@ function initFontSizeMenu(menuPopup, ful
     var htmlInfo = "";
     EditorGetTextProperty("small", "", "", firstHas, anyHas, allHas);
     if (anyHas.value)
       htmlInfo = "<small>";
     EditorGetTextProperty("big", "", "", firstHas, anyHas, allHas);
     if (anyHas.value)
       htmlInfo += "<big>";
 
-    if (htmlInfo)
-    {
+    if (htmlInfo) {
       menuPopup.lastChild.hidden = false;
       menuPopup.lastChild.setAttribute("label", "HTML: " + htmlInfo);
       menuPopup.lastChild.setAttribute("checked", true);
-    }
-    else
-    {
+    } else {
       menuPopup.lastChild.hidden = true;
     }
   }
 }
 
-function onHighlightColorChange()
-{
+function onHighlightColorChange() {
   ChangeButtonColor("cmd_highlight", "HighlightColorButton",
                     "transparent");
 }
 
-function onFontColorChange()
-{
+function onFontColorChange() {
   ChangeButtonColor("cmd_fontColor", "TextColorButton",
                     gDefaultTextColor);
 }
 
-function onBackgroundColorChange()
-{
+function onBackgroundColorChange() {
   ChangeButtonColor("cmd_backgroundColor", "BackgroundColorButton",
                     gDefaultBackgroundColor);
 }
 
 /* Helper function that changes the button color.
  *   commandID - The ID of the command element.
  *   id - The ID of the button needing to be changed.
  *   defaultColor - The default color the button gets set to.
  */
 function ChangeButtonColor(commandID, id, defaultColor) {
   var commandNode = document.getElementById(commandID);
-  if (commandNode)
-  {
+  if (commandNode) {
     var color = commandNode.getAttribute("state");
     var button = document.getElementById(id);
-    if (button)
-    {
+    if (button) {
       button.setAttribute("color", color);
 
       // No color or a mixed color - get color set on page or other defaults.
       if (!color || color == "mixed")
         color = defaultColor;
 
       button.setAttribute("style", "background-color:" + color + " !important");
     }
   }
 }
 
 // Call this when user changes text and/or background colors of the page
-function UpdateDefaultColors()
-{
+function UpdateDefaultColors() {
   var BrowserColors = GetDefaultBrowserColors();
   var bodyelement = GetBodyElement();
   var defTextColor = gDefaultTextColor;
   var defBackColor = gDefaultBackgroundColor;
 
-  if (bodyelement)
-  {
+  if (bodyelement) {
     var color = bodyelement.getAttribute("text");
     if (color)
       gDefaultTextColor = color;
     else if (BrowserColors)
       gDefaultTextColor = BrowserColors.TextColor;
 
     color = bodyelement.getAttribute("bgcolor");
     if (color)
       gDefaultBackgroundColor = color;
     else if (BrowserColors)
       gDefaultBackgroundColor = BrowserColors.BackgroundColor;
   }
 
   // Trigger update on toolbar
-  if (defTextColor != gDefaultTextColor)
-  {
+  if (defTextColor != gDefaultTextColor) {
     goUpdateCommandState("cmd_fontColor");
     onFontColorChange();
   }
-  if (defBackColor != gDefaultBackgroundColor)
-  {
+  if (defBackColor != gDefaultBackgroundColor) {
     goUpdateCommandState("cmd_backgroundColor");
     onBackgroundColorChange();
   }
 }
 
-function GetBackgroundElementWithColor()
-{
+function GetBackgroundElementWithColor() {
   var editor = GetCurrentTableEditor();
   if (!editor)
     return null;
 
   gColorObj.Type = "";
   gColorObj.PageColor = "";
   gColorObj.TableColor = "";
   gColorObj.CellColor = "";
   gColorObj.BackgroundColor = "";
   gColorObj.SelectedType = "";
 
   var tagNameObj = { value: "" };
   var element;
   try {
-    element = editor.getSelectedOrParentTableElement(tagNameObj, {value:0});
-  }
-  catch(e) {}
-
-  if (element && tagNameObj && tagNameObj.value)
-  {
+    element = editor.getSelectedOrParentTableElement(tagNameObj, {value: 0});
+  } catch (e) {}
+
+  if (element && tagNameObj && tagNameObj.value) {
     gColorObj.BackgroundColor = GetHTMLOrCSSStyleValue(element, "bgcolor", "background-color");
     gColorObj.BackgroundColor = ConvertRGBColorIntoHEXColor(gColorObj.BackgroundColor);
-    if (tagNameObj.value.toLowerCase() == "td")
-    {
+    if (tagNameObj.value.toLowerCase() == "td") {
       gColorObj.Type = "Cell";
       gColorObj.CellColor = gColorObj.BackgroundColor;
 
       // Get any color that might be on parent table
       var table = GetParentTable(element);
       gColorObj.TableColor = GetHTMLOrCSSStyleValue(table, "bgcolor", "background-color");
       gColorObj.TableColor = ConvertRGBColorIntoHEXColor(gColorObj.TableColor);
-    }
-    else
-    {
+    } else {
       gColorObj.Type = "Table";
       gColorObj.TableColor = gColorObj.BackgroundColor;
     }
     gColorObj.SelectedType = gColorObj.Type;
-  }
-  else
-  {
+  } else {
     let IsCSSPrefChecked = Services.prefs.getBoolPref(kUseCssPref);
-    if (IsCSSPrefChecked && IsHTMLEditor())
-    {
+    if (IsCSSPrefChecked && IsHTMLEditor()) {
       let selection = editor.selection;
-      if (selection)
-      {
+      if (selection) {
         element = selection.focusNode;
         while (!editor.nodeIsBlock(element))
           element = element.parentNode;
-      }
-      else
-      {
+      } else {
         element = GetBodyElement();
       }
-    }
-    else
-    {
+    } else {
       element = GetBodyElement();
     }
-    if (element)
-    {
+    if (element) {
       gColorObj.Type = "Page";
       gColorObj.BackgroundColor = GetHTMLOrCSSStyleValue(element, "bgcolor", "background-color");
-      if (gColorObj.BackgroundColor == "")
-      {
+      if (gColorObj.BackgroundColor == "") {
         gColorObj.BackgroundColor = "transparent";
-      }
-      else
-      {
+      } else {
         gColorObj.BackgroundColor = ConvertRGBColorIntoHEXColor(gColorObj.BackgroundColor);
       }
       gColorObj.PageColor = gColorObj.BackgroundColor;
     }
   }
   return element;
 }
 
-function SetSmiley(smileyText)
-{
+function SetSmiley(smileyText) {
   try {
     GetCurrentEditor().insertText(smileyText);
     gContentWindow.focus();
-  }
-  catch(e) {}
+  } catch (e) {}
 }
 
-function EditorSelectColor(colorType, mouseEvent)
-{
+function EditorSelectColor(colorType, mouseEvent) {
   var editor = GetCurrentEditor();
   if (!editor || !gColorObj)
     return;
 
   // Shift + mouse click automatically applies last color, if available
-  var useLastColor = mouseEvent ? ( mouseEvent.button == 0 && mouseEvent.shiftKey ) : false;
+  var useLastColor = mouseEvent ? (mouseEvent.button == 0 && mouseEvent.shiftKey) : false;
   var element;
   var table;
   var currentColor = "";
   var commandNode;
 
   if (!colorType)
     colorType = "";
 
-  if (colorType == "Text")
-  {
+  if (colorType == "Text") {
     gColorObj.Type = colorType;
 
     // Get color from command node state
     commandNode = document.getElementById("cmd_fontColor");
     currentColor = commandNode.getAttribute("state");
     currentColor = ConvertRGBColorIntoHEXColor(currentColor);
     gColorObj.TextColor = currentColor;
 
-    if (useLastColor && gColorObj.LastTextColor )
+    if (useLastColor && gColorObj.LastTextColor)
       gColorObj.TextColor = gColorObj.LastTextColor;
     else
       useLastColor = false;
-  }
-  else if (colorType == "Highlight")
-  {
+  } else if (colorType == "Highlight") {
     gColorObj.Type = colorType;
 
     // Get color from command node state
     commandNode = document.getElementById("cmd_highlight");
     currentColor = commandNode.getAttribute("state");
     currentColor = ConvertRGBColorIntoHEXColor(currentColor);
     gColorObj.HighlightColor = currentColor;
 
-    if (useLastColor && gColorObj.LastHighlightColor )
+    if (useLastColor && gColorObj.LastHighlightColor)
       gColorObj.HighlightColor = gColorObj.LastHighlightColor;
     else
       useLastColor = false;
-  }
-  else
-  {
+  } else {
     element = GetBackgroundElementWithColor();
     if (!element)
       return;
 
     // Get the table if we found a cell
     if (gColorObj.Type == "Table")
       table = element;
     else if (gColorObj.Type == "Cell")
       table = GetParentTable(element);
 
     // Save to avoid resetting if not necessary
     currentColor = gColorObj.BackgroundColor;
 
-    if (colorType == "TableOrCell" || colorType == "Cell")
-    {
+    if (colorType == "TableOrCell" || colorType == "Cell") {
       if (gColorObj.Type == "Cell")
         gColorObj.Type = colorType;
       else if (gColorObj.Type != "Table")
         return;
-    }
-    else if (colorType == "Table" && gColorObj.Type == "Page")
+    } else if (colorType == "Table" && gColorObj.Type == "Page")
       return;
 
-    if (colorType == "" && gColorObj.Type == "Cell")
-    {
+    if (colorType == "" && gColorObj.Type == "Cell") {
       // Using empty string for requested type means
       //  we can let user select cell or table
       gColorObj.Type = "TableOrCell";
     }
 
-    if (useLastColor && gColorObj.LastBackgroundColor )
+    if (useLastColor && gColorObj.LastBackgroundColor)
       gColorObj.BackgroundColor = gColorObj.LastBackgroundColor;
     else
       useLastColor = false;
   }
   // Save the type we are really requesting
   colorType = gColorObj.Type;
 
-  if (!useLastColor)
-  {
+  if (!useLastColor) {
     // Avoid the JS warning
     gColorObj.NoDefault = false;
 
     // Launch the ColorPicker dialog
     // TODO: Figure out how to position this under the color buttons on the toolbar
     window.openDialog("chrome://editor/content/EdColorPicker.xul", "_blank", "chrome,close,titlebar,modal", "", gColorObj);
 
     // User canceled the dialog
     if (gColorObj.Cancel)
       return;
   }
 
-  if (gColorObj.Type == "Text")
-  {
-    if (currentColor != gColorObj.TextColor)
-    {
+  if (gColorObj.Type == "Text") {
+    if (currentColor != gColorObj.TextColor) {
       if (gColorObj.TextColor)
         EditorSetTextProperty("font", "color", gColorObj.TextColor);
       else
         EditorRemoveTextProperty("font", "color");
     }
     // Update the command state (this will trigger color button update)
     goUpdateCommandState("cmd_fontColor");
-  }
-  else if (gColorObj.Type == "Highlight")
-  {
-    if (currentColor != gColorObj.HighlightColor)
-    {
+  } else if (gColorObj.Type == "Highlight") {
+    if (currentColor != gColorObj.HighlightColor) {
       if (gColorObj.HighlightColor)
         EditorSetTextProperty("font", "bgcolor", gColorObj.HighlightColor);
       else
         EditorRemoveTextProperty("font", "bgcolor");
     }
     // Update the command state (this will trigger color button update)
     goUpdateCommandState("cmd_highlight");
-  }
-  else if (element)
-  {
-    if (gColorObj.Type == "Table")
-    {
+  } else if (element) {
+    if (gColorObj.Type == "Table") {
       // Set background on a table
       // Note that we shouldn't trust "currentColor" because of "TableOrCell" behavior
-      if (table)
-      {
+      if (table) {
         var bgcolor = table.getAttribute("bgcolor");
         if (bgcolor != gColorObj.BackgroundColor)
         try {
           if (gColorObj.BackgroundColor)
             editor.setAttributeOrEquivalent(table, "bgcolor", gColorObj.BackgroundColor, false);
           else
             editor.removeAttributeOrEquivalent(table, "bgcolor", false);
         } catch (e) {}
       }
-    }
-    else if (currentColor != gColorObj.BackgroundColor && IsHTMLEditor())
-    {
+    } else if (currentColor != gColorObj.BackgroundColor && IsHTMLEditor()) {
       editor.beginTransaction();
-      try
-      {
+      try {
         editor.setBackgroundColor(gColorObj.BackgroundColor);
 
-        if (gColorObj.Type == "Page" && gColorObj.BackgroundColor)
-        {
+        if (gColorObj.Type == "Page" && gColorObj.BackgroundColor) {
           // Set all page colors not explicitly set,
           //  else you can end up with unreadable pages
           //  because viewer's default colors may not be same as page author's
           var bodyelement = GetBodyElement();
-          if (bodyelement)
-          {
+          if (bodyelement) {
             var defColors = GetDefaultBrowserColors();
-            if (defColors)
-            {
+            if (defColors) {
               if (!bodyelement.getAttribute("text"))
                 editor.setAttributeOrEquivalent(bodyelement, "text", defColors.TextColor, false);
 
               // The following attributes have no individual CSS declaration counterparts
               // Getting rid of them in favor of CSS implies CSS rules management
               if (!bodyelement.getAttribute("link"))
                 editor.setAttribute(bodyelement, "link", defColors.LinkColor);
 
               if (!bodyelement.getAttribute("alink"))
                 editor.setAttribute(bodyelement, "alink", defColors.ActiveLinkColor);
 
               if (!bodyelement.getAttribute("vlink"))
                 editor.setAttribute(bodyelement, "vlink", defColors.VisitedLinkColor);
             }
           }
         }
-      }
-      catch(e) {}
+      } catch (e) {}
 
       editor.endTransaction();
     }
 
     goUpdateCommandState("cmd_backgroundColor");
   }
   gContentWindow.focus();
 }
 
-function GetParentTable(element)
-{
+function GetParentTable(element) {
   var node = element;
-  while (node)
-  {
+  while (node) {
     if (node.nodeName.toLowerCase() == "table")
       return node;
 
     node = node.parentNode;
   }
   return node;
 }
 
-function GetParentTableCell(element)
-{
+function GetParentTableCell(element) {
   var node = element;
-  while (node)
-  {
+  while (node) {
     if (node.nodeName.toLowerCase() == "td" || node.nodeName.toLowerCase() == "th")
       return node;
 
     node = node.parentNode;
   }
   return node;
 }
 
-function EditorDblClick(event)
-{
+function EditorDblClick(event) {
   // We check event.explicitOriginalTarget here because .target will never
   // be a textnode (bug 193689)
-  if (event.explicitOriginalTarget)
-  {
+  if (event.explicitOriginalTarget) {
     // Only bring up properties if clicked on an element or selected link
     var element;
     try {
       element = event.explicitOriginalTarget;
     } catch (e) {}
 
      //  We use "href" instead of "a" to not be fooled by named anchor
     if (!element)
       try {
         element = GetCurrentEditor().getSelectedElement("href");
       } catch (e) {}
 
     // Don't fire for body/p and other block elements.
     // It's common that people try to double-click
     // to select a word, but the click hits an empty area.
     if (element &&
-        !["body","p","h1","h2","h3","h4","h5","h6","blockquote","div","pre"]
-         .includes(element.nodeName.toLowerCase()))
-    {
+        !["body", "p", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "div", "pre"]
+         .includes(element.nodeName.toLowerCase())) {
       goDoCommand("cmd_objectProperties");
       event.preventDefault();
     }
   }
 }
 
-function EditorClick(event)
-{
+function EditorClick(event) {
   // For Web Composer: In Show All Tags Mode,
   // single click selects entire element,
   //  except for body and table elements
-  if (gEditorDisplayMode == kDisplayModeAllTags)
-  {
-    try
-    {
+  if (gEditorDisplayMode == kDisplayModeAllTags) {
+    try {
       // We check event.explicitOriginalTarget here because .target will never
       // be a textnode (bug 193689)
       var element = event.explicitOriginalTarget;
       var name = element.localName;
-      if (!["body", "caption", "table", "td", "th", "tr"].includes(name))
-      {
+      if (!["body", "caption", "table", "td", "th", "tr"].includes(name)) {
         GetCurrentEditor().selectElement(event.explicitOriginalTarget);
         event.preventDefault();
       }
     } catch (e) {}
   }
 }
 
-/*TODO: We need an oncreate hook to do enabling/disabling for the
+/* TODO: We need an oncreate hook to do enabling/disabling for the
         Format menu. There should be code like this for the
         object-specific "Properties" item
 */
 // For property dialogs, we want the selected element,
 //  but will accept a parent link, list, or table cell if inside one
-function GetObjectForProperties()
-{
+function GetObjectForProperties() {
   var editor = GetCurrentEditor();
   if (!editor || !IsHTMLEditor())
     return null;
 
   var element;
   try {
     element = editor.getSelectedElement("");
   } catch (e) {}
@@ -1661,114 +1493,103 @@ function GetObjectForProperties()
       GetCurrentEditor().selection.collapse(element, 0);
     } else
       return element;
   }
 
   // Find nearest parent of selection anchor node
   //   that is a link, list, table cell, or table
 
-  var anchorNode
+  var anchorNode;
   var node;
   try {
     anchorNode = editor.selection.anchorNode;
-    if (anchorNode.firstChild)
-    {
+    if (anchorNode.firstChild) {
       // Start at actual selected node
       var offset = editor.selection.anchorOffset;
       // Note: If collapsed, offset points to element AFTER caret,
       //  thus node may be null
       node = anchorNode.childNodes.item(offset);
     }
     if (!node)
       node = anchorNode;
   } catch (e) {}
 
-  while (node)
-  {
-    if (node.nodeName)
-    {
+  while (node) {
+    if (node.nodeName) {
       var nodeName = node.nodeName.toLowerCase();
 
       // Done when we hit the body
       if (nodeName == "body") break;
 
       if ((nodeName == "a" && node.href) ||
           nodeName == "ol" || nodeName == "ul" || nodeName == "dl" ||
           nodeName == "td" || nodeName == "th" ||
-          nodeName == "table" || nodeName == "math")
-      {
+          nodeName == "table" || nodeName == "math") {
         return node;
       }
     }
     node = node.parentNode;
   }
   return null;
 }
 
-function SetEditMode(mode)
-{
+function SetEditMode(mode) {
   if (!IsHTMLEditor())
     return;
 
   var bodyElement = GetBodyElement();
-  if (!bodyElement)
-  {
+  if (!bodyElement) {
     dump("SetEditMode: We don't have a body node!\n");
     return;
   }
 
   // must have editor if here!
   var editor = GetCurrentEditor();
-  var inlineSpellCheckItem = document.getElementById('menu_inlineSpellCheck');
+  var inlineSpellCheckItem = document.getElementById("menu_inlineSpellCheck");
 
   // 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)
-  {
+  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)
-    {
+    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)
-        {
+      if (doctypeNode) {
+        if (dt) {
           doctypeNode.collapsed = false;
           var doctypeText = "<!DOCTYPE " + domdoc.doctype.name;
           if (dt.publicId)
             doctypeText += " PUBLIC \"" + domdoc.doctype.publicId;
           if (dt.systemId)
             doctypeText += " \"" + dt.systemId;
-          doctypeText += "\">"
+          doctypeText += "\">";
           doctypeNode.setAttribute("value", doctypeText);
-        }
-        else
+        } else
           doctypeNode.collapsed = true;
       }
     }
     // Get the entire document's source string
 
     var flags = (editor.documentCharacterSet == "ISO-8859-1")
       ? kOutputEncodeLatin1Entities
       : kOutputEncodeBasicEntities;
     try {
       let encodeEntity = Services.prefs.getCharPref("editor.encode_entity");
       switch (encodeEntity) {
-        case "basic"  : flags = kOutputEncodeBasicEntities; break;
+        case "basic" : flags = kOutputEncodeBasicEntities; break;
         case "latin1" : flags = kOutputEncodeLatin1Entities; break;
-        case "html"   : flags = kOutputEncodeHTMLEntities; break;
-        case "none"   : flags = 0;     break;
+        case "html" : flags = kOutputEncodeHTMLEntities; break;
+        case "none" : flags = 0; break;
       }
     } catch (e) { }
 
     if (Services.prefs.getBoolPref("editor.prettyprint"))
       flags |= kOutputFormatted;
 
     flags |= kOutputLFLineBreak;
     var source = editor.outputToString(editor.contentsMIMEType, flags);
@@ -1776,25 +1597,22 @@ function SetEditMode(mode)
     if (start == -1) start = 0;
     gSourceTextEditor.insertText(source.slice(start));
     gSourceTextEditor.resetModificationCount();
     gSourceTextEditor.addDocumentStateListener(gSourceTextListener);
     gSourceTextEditor.enableUndo(true);
     gSourceContentWindow.commandManager.addCommandObserver(gSourceTextObserver, "cmd_undo");
     gSourceContentWindow.contentWindow.focus();
     goDoCommand("cmd_moveTop");
-  }
-  else if (previousMode == kDisplayModeSource)
-  {
+  } else if (previousMode == kDisplayModeSource) {
     // Only rebuild document if a change was made in source window
-    if (IsHTMLSourceChanged())
-    {
+    if (IsHTMLSourceChanged()) {
       // Disable spell checking when rebuilding source
       InlineSpellCheckerUI.enabled = false;
-      inlineSpellCheckItem.removeAttribute('checked');
+      inlineSpellCheckItem.removeAttribute("checked");
 
       // 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) {}
 
@@ -1812,17 +1630,16 @@ function SetEditMode(mode)
           editor.document.replaceChild(fragment.firstChild, editor.document.documentElement);
           editor.enableUndo(true);
         }
 
         // Get the text for the <title> from the newly-parsed document
         // (must do this for proper conversion of "escaped" characters)
         let titleNode = editor.document.querySelector("title");
         SetDocumentTitle(titleNode ? titleNode.textContent : "");
-
       } catch (ex) {
         dump(ex);
       }
       editor.endTransaction();
 
       // Restore unlimited undo count
       try {
         editor.transactionManager.maxTransactionCount = -1;
@@ -1834,80 +1651,74 @@ function SetEditMode(mode)
     gSourceTextEditor.removeDocumentStateListener(gSourceTextListener);
     gSourceTextEditor.enableUndo(false);
     gSourceTextEditor.selectAll();
     gSourceTextEditor.deleteSelection(gSourceTextEditor.eNone,
                                       gSourceTextEditor.eStrip);
     gSourceTextEditor.resetModificationCount();
 
     gContentWindow.focus();
-    //goDoCommand("cmd_moveTop");
+    // goDoCommand("cmd_moveTop");
   }
 
   switch (mode) {
     case kDisplayModePreview:
       // Disable spell checking when previewing
       InlineSpellCheckerUI.enabled = false;
-      inlineSpellCheckItem.removeAttribute('checked');
+      inlineSpellCheckItem.removeAttribute("checked");
       // fall through
     case kDisplayModeSource:
-      inlineSpellCheckItem.setAttribute('disabled', 'true');
+      inlineSpellCheckItem.setAttribute("disabled", "true");
       break;
     default:
-      inlineSpellCheckItem.setAttribute('disabled', !InlineSpellCheckerUI.canSpellCheck);
+      inlineSpellCheckItem.setAttribute("disabled", !InlineSpellCheckerUI.canSpellCheck);
       break;
   }
 }
 
-function CancelHTMLSource()
-{
+function CancelHTMLSource() {
   // Don't convert source text back into the DOM document
   gSourceTextEditor.resetModificationCount();
   SetDisplayMode(gPreviousNonSourceDisplayMode);
 }
 
-function SetDisplayMode(mode)
-{
+function SetDisplayMode(mode) {
   if (!IsHTMLEditor())
     return false;
 
   // Already in requested mode:
   //  return false to indicate we didn't switch
   if (mode == gEditorDisplayMode)
     return false;
 
   var previousMode = gEditorDisplayMode;
   gEditorDisplayMode = mode;
 
   ResetStructToolbar();
-  if (mode == kDisplayModeSource)
-  {
+  if (mode == kDisplayModeSource) {
     // Switch to the sourceWindow (second in the deck)
     gContentWindowDeck.selectedIndex = 1;
 
-    //Hide the formatting toolbar if not already hidden
+    // Hide the formatting toolbar if not already hidden
     gFormatToolbarHidden = gFormatToolbar.hidden;
     gFormatToolbar.hidden = true;
     gViewFormatToolbar.hidden = true;
 
     gSourceContentWindow.contentWindow.focus();
-  }
-  else
-  {
+  } else {
     // Save the last non-source mode so we can cancel source editing easily
     gPreviousNonSourceDisplayMode = mode;
 
     // Load/unload appropriate override style sheet
     try {
       var editor = GetCurrentEditor();
       editor.QueryInterface(nsIEditorStyleSheets);
       editor instanceof Ci.nsIHTMLObjectResizer;
 
-      switch (mode)
-      {
+      switch (mode) {
         case kDisplayModePreview:
           // Disable all extra "edit mode" style sheets
           editor.enableStyleSheet(kNormalStyleSheet, false);
           editor.enableStyleSheet(kAllTagsStyleSheet, false);
           editor.objectResizingEnabled = true;
           break;
 
         case kDisplayModeNormal:
@@ -1923,17 +1734,17 @@ function SetDisplayMode(mode)
           // don't allow resizing in AllTags mode because the visible tags
           // change the computed size of images and tables...
           if (editor.resizedObject) {
             editor.hideResizers();
           }
           editor.objectResizingEnabled = false;
           break;
       }
-    } catch(e) {}
+    } catch (e) {}
 
     // Switch to the normal editor (first in the deck)
     gContentWindowDeck.selectedIndex = 0;
 
     // Restore menus and toolbars
     gFormatToolbar.hidden = gFormatToolbarHidden;
     gViewFormatToolbar.hidden = false;
 
@@ -1944,34 +1755,32 @@ function SetDisplayMode(mode)
   window.updateCommands("mode_switch");
 
   // Set the selected tab at bottom of window:
   // (Note: Setting "selectedIndex = mode" won't redraw tabs when menu is used.)
   document.getElementById("EditModeTabs").selectedItem = document.getElementById(kDisplayModeTabIDS[mode]);
 
   // Uncheck previous menuitem and set new check since toolbar may have been used
   if (previousMode >= 0)
-    document.getElementById(kDisplayModeMenuIDs[previousMode]).setAttribute("checked","false");
-  document.getElementById(kDisplayModeMenuIDs[mode]).setAttribute("checked","true");
+    document.getElementById(kDisplayModeMenuIDs[previousMode]).setAttribute("checked", "false");
+  document.getElementById(kDisplayModeMenuIDs[mode]).setAttribute("checked", "true");
 
 
   return true;
 }
 
-function UpdateWindowTitle()
-{
+function UpdateWindowTitle() {
   try {
     var filename = "";
     var windowTitle = "";
     var title = GetDocumentTitle();
 
     // Append just the 'leaf' filename to the Doc. Title for the window caption
     var docUrl = GetDocumentUrl();
-    if (docUrl && !IsUrlAboutBlank(docUrl))
-    {
+    if (docUrl && !IsUrlAboutBlank(docUrl)) {
       var scheme = GetScheme(docUrl);
       filename = GetFilename(docUrl);
       if (filename)
         windowTitle = " [" + scheme + ":/.../" + filename + "]";
 
       var fileType = IsHTMLEditor() ? "html" : "text";
       // Save changed title in the recent pages data in prefs
       SaveRecentFilesPrefs(title, fileType);
@@ -1982,102 +1791,91 @@ function UpdateWindowTitle()
 
     document.title = (title || filename || gUntitledString) +
                      windowTitle +
                      xulWin.getAttribute("titlemenuseparator") +
                      xulWin.getAttribute("titlemodifier");
   } catch (e) { dump(e); }
 }
 
-function SaveRecentFilesPrefs(aTitle, aFileType)
-{
+function SaveRecentFilesPrefs(aTitle, aFileType) {
   var curUrl = StripPassword(GetDocumentUrl());
   var historyCount = Services.prefs.getIntPref("editor.history.url_maximum");
 
   var titleArray = [];
   var urlArray = [];
   var typeArray = [];
 
-  if (historyCount && !IsUrlAboutBlank(curUrl) &&  GetScheme(curUrl) != "data")
-  {
+  if (historyCount && !IsUrlAboutBlank(curUrl) && GetScheme(curUrl) != "data") {
     titleArray.push(aTitle);
     urlArray.push(curUrl);
     typeArray.push(aFileType);
   }
 
-  for (let i = 0; i < historyCount && urlArray.length < historyCount; i++)
-  {
+  for (let i = 0; i < historyCount && urlArray.length < historyCount; i++) {
     let url = Services.prefs.getStringPref("editor.history_url_" + i, "");
 
     // Continue if URL pref is missing because
     //  a URL not found during loading may have been removed
 
     // Skip over current an "data" URLs
-    if (url && url != curUrl && GetScheme(url) != "data")
-    {
+    if (url && url != curUrl && GetScheme(url) != "data") {
       let title = Services.prefs.getStringPref("editor.history_title_" + i, "");
       let fileType = Services.prefs.getStringPref("editor.history_type_" + i, "");
       titleArray.push(title);
       urlArray.push(url);
       typeArray.push(fileType);
     }
   }
 
   // Resave the list back to prefs in the new order
-  for (let i = 0; i < urlArray.length; i++)
-  {
+  for (let i = 0; i < urlArray.length; i++) {
     SetStringPref("editor.history_title_" + i, titleArray[i]);
     SetStringPref("editor.history_url_" + i, urlArray[i]);
     SetStringPref("editor.history_type_" + i, typeArray[i]);
   }
 }
 
-function EditorInitFormatMenu()
-{
+function EditorInitFormatMenu() {
   try {
     InitObjectPropertiesMenuitem();
     InitRemoveStylesMenuitems("removeStylesMenuitem", "removeLinksMenuitem", "removeNamedAnchorsMenuitem");
-  } catch(ex) {}
+  } catch (ex) {}
 }
 
-function InitObjectPropertiesMenuitem()
-{
+function InitObjectPropertiesMenuitem() {
   // Set strings and enable for the [Object] Properties item
   // Note that we directly do the enabling instead of
   // using goSetCommandEnabled since we already have the command.
   var cmd = document.getElementById("cmd_objectProperties");
   if (!cmd)
     return null;
 
   var element;
   var menuStr = GetString("AdvancedProperties");
   var name;
 
   if (IsEditingRenderedHTML())
     element = GetObjectForProperties();
 
-  if (element && element.nodeName)
-  {
+  if (element && element.nodeName) {
     var objStr = "";
     cmd.removeAttribute("disabled");
     name = element.nodeName.toLowerCase();
-    switch (name)
-    {
+    switch (name) {
       case "img":
         // Check if img is enclosed in link
         //  (use "href" to not be fooled by named anchor)
-        try
-        {
-          if (GetCurrentEditor().getElementOrParentByTagName("href", element))
-          {
+        try {
+          if (GetCurrentEditor().getElementOrParentByTagName("href", element)) {
             objStr = GetString("ImageAndLink");
             // Return "href" so it is detected as a link.
             name = "href";
           }
-        } catch(e) {}
+        } catch (e) {}
 
         if (objStr == "")
           objStr = GetString("Image");
         break;
       case "hr":
         objStr = GetString("HLine");
         break;
       case "table":
@@ -2117,89 +1915,80 @@ function InitObjectPropertiesMenuitem()
         break;
       case "label":
         objStr = GetString("Label");
         break;
       case "fieldset":
         objStr = GetString("FieldSet");
         break;
       case "a":
-        if (element.name)
-        {
+        if (element.name) {
           objStr = GetString("NamedAnchor");
           name = "anchor";
-        }
-        else if(element.href)
-        {
+        } else if (element.href) {
           objStr = GetString("Link");
           name = "href";
         }
         break;
     }
     if (objStr)
-      menuStr = GetString("ObjectProperties").replace(/%obj%/,objStr);
-  }
-  else
-  {
+      menuStr = GetString("ObjectProperties").replace(/%obj%/, objStr);
+  } else {
     // We show generic "Properties" string, but disable the command.
     cmd.setAttribute("disabled", "true");
   }
   cmd.setAttribute("label", menuStr);
   cmd.setAttribute("accesskey", GetString("ObjectPropertiesAccessKey"));
   return name;
 }
 
-function InitParagraphMenu()
-{
+function InitParagraphMenu() {
   var mixedObj = { value: null };
   var state;
   try {
     state = GetCurrentEditor().getParagraphState(mixedObj);
-  }
-  catch(e) {}
+  } catch (e) {}
   var IDSuffix;
 
   // PROBLEM: When we get blockquote, it masks other styles contained by it
   // We need a separate method to get blockquote state
 
   // We use "x" as uninitialized paragraph state
   if (!state || state == "x")
-    IDSuffix = "bodyText" // No paragraph container
+    IDSuffix = "bodyText"; // No paragraph container
   else
     IDSuffix = state;
 
   // Set "radio" check on one item, but...
-  var menuItem = document.getElementById("menu_"+IDSuffix);
+  var menuItem = document.getElementById("menu_" + IDSuffix);
   menuItem.setAttribute("checked", "true");
 
   // ..."bodyText" is returned if mixed selection, so remove checkmark
   if (mixedObj.value)
     menuItem.setAttribute("checked", "false");
 }
 
-function GetListStateString()
-{
+function GetListStateString() {
   try {
     var editor = GetCurrentEditor();
 
     var mixedObj = { value: null };
     var hasOL = { value: false };
     var hasUL = { value: false };
     var hasDL = { value: false };
     editor.getListState(mixedObj, hasOL, hasUL, hasDL);
 
     if (mixedObj.value)
       return "mixed";
     if (hasOL.value)
       return "ol";
     if (hasUL.value)
       return "ul";
 
-    if (hasDL.value)
-    {
+    if (hasDL.value) {
       var hasLI = { value: false };
       var hasDT = { value: false };
       var hasDD = { value: false };
       editor.getListItemState(mixedObj, hasLI, hasDT, hasDD);
       if (mixedObj.value)
         return "mixed";
       if (hasLI.value)
         return "li";
@@ -2209,35 +1998,33 @@ function GetListStateString()
         return "dd";
     }
   } catch (e) {}
 
   // return "noList" if we aren't in a list at all
   return "noList";
 }
 
-function InitListMenu()
-{
+function InitListMenu() {
   if (!IsHTMLEditor())
     return;
 
   var IDSuffix = GetListStateString();
 
   // Set enable state for the "None" menuitem
   goSetCommandEnabled("cmd_removeList", IDSuffix != "noList");
 
   // Set "radio" check on one item, but...
   // we won't find a match if it's "mixed"
-  var menuItem = document.getElementById("menu_"+IDSuffix);
+  var menuItem = document.getElementById("menu_" + IDSuffix);
   if (menuItem)
     menuItem.setAttribute("checked", "true");
 }
 
-function GetAlignmentString()
-{
+function GetAlignmentString() {
   var mixedObj = { value: null };
   var alignObj = { value: null };
   try {
     GetCurrentEditor().getAlignment(mixedObj, alignObj);
   } catch (e) {}
 
   if (mixedObj.value)
     return "mixed";
@@ -2249,176 +2036,157 @@ function GetAlignmentString()
     return "right";
   if (alignObj.value == nsIHTMLEditor.eJustify)
     return "justify";
 
   // return "left" if we got here
   return "left";
 }
 
-function InitAlignMenu()
-{
+function InitAlignMenu() {
   if (!IsHTMLEditor())
     return;
 
   var IDSuffix = GetAlignmentString();
 
   // we won't find a match if it's "mixed"
-  var menuItem = document.getElementById("menu_"+IDSuffix);
+  var menuItem = document.getElementById("menu_" + IDSuffix);
   if (menuItem)
     menuItem.setAttribute("checked", "true");
 }
 
-function EditorSetDefaultPrefsAndDoctype()
-{
+function EditorSetDefaultPrefsAndDoctype() {
   var editor = GetCurrentEditor();
 
   var domdoc;
   try {
     domdoc = editor.document;
-  } catch (e) { dump( e + "\n"); }
-  if ( !domdoc )
-  {
+  } catch (e) { dump(e + "\n"); }
+  if (!domdoc) {
     dump("EditorSetDefaultPrefsAndDoctype: EDITOR DOCUMENT NOT FOUND\n");
     return;
   }
 
   // Insert a doctype element
   // if it is missing from existing doc
-  if (!domdoc.doctype)
-  {
-    var newdoctype = domdoc.implementation.createDocumentType("HTML", "-//W3C//DTD HTML 4.01 Transitional//EN","");
+  if (!domdoc.doctype) {
+    var newdoctype = domdoc.implementation.createDocumentType("HTML", "-//W3C//DTD HTML 4.01 Transitional//EN", "");
     if (newdoctype)
       domdoc.insertBefore(newdoctype, domdoc.firstChild);
   }
 
   // search for head; we'll need this for meta tag additions
   let headelement = domdoc.querySelector("head");
-  if (!headelement)
-  {
+  if (!headelement) {
     headelement = domdoc.createElement("head");
     if (headelement)
       domdoc.insertAfter(headelement, domdoc.firstChild);
   }
 
   /* only set default prefs for new documents */
   if (!IsUrlAboutBlank(GetDocumentUrl()))
     return;
 
   // search for author meta tag.
   // if one is found, don't do anything.
   // if not, create one and make it a child of the head tag
   //   and set its content attribute to the value of the editor.author preference.
 
-  if (domdoc.querySelector("meta"))
-  {
+  if (domdoc.querySelector("meta")) {
     // we should do charset first since we need to have charset before
     // hitting other 8-bit char in other meta tags
     // grab charset pref and make it the default charset
     var element;
     var prefCharsetString = Services.prefs.getCharPref("intl.charset.fallback.override");
     if (prefCharsetString)
       editor.documentCharacterSet = prefCharsetString;
 
     // let's start by assuming we have an author in case we don't have the pref
 
     var prefAuthorString = null;
     let authorFound = domdoc.querySelector('meta[name="author"]');
-    try
-    {
+    try {
       prefAuthorString = Services.prefs.getStringPref("editor.author");
-    }
-    catch (ex) {}
-    if (prefAuthorString && prefAuthorString != 0 && !authorFound && headelement)
-    {
+    } catch (ex) {}
+    if (prefAuthorString && prefAuthorString != 0 && !authorFound && headelement) {
       // create meta tag with 2 attributes
       element = domdoc.createElement("meta");
-      if (element)
-      {
+      if (element) {
         element.setAttribute("name", "author");
         element.setAttribute("content", prefAuthorString);
         headelement.appendChild(element);
       }
     }
   }
 
   // add title tag if not present
-  if (headelement && !editor.document.querySelector("title"))
-  {
+  if (headelement && !editor.document.querySelector("title")) {
      var titleElement = domdoc.createElement("title");
      if (titleElement)
        headelement.appendChild(titleElement);
   }
 
   // find body node
   var bodyelement = GetBodyElement();
-  if (bodyelement)
-  {
-    if (Services.prefs.getBoolPref("editor.use_custom_colors"))
-    {
+  if (bodyelement) {
+    if (Services.prefs.getBoolPref("editor.use_custom_colors")) {
       let text_color = Services.prefs.getCharPref("editor.text_color");
       let background_color = Services.prefs.getCharPref("editor.background_color");
 
       // add the color attributes to the body tag.
       // and use them for the default text and background colors if not empty
       editor.setAttributeOrEquivalent(bodyelement, "text", text_color, true);
       gDefaultTextColor = text_color;
       editor.setAttributeOrEquivalent(bodyelement, "bgcolor", background_color, true);
-      gDefaultBackgroundColor = background_color
+      gDefaultBackgroundColor = background_color;
       bodyelement.setAttribute("link", Services.prefs.getCharPref("editor.link_color"));
       bodyelement.setAttribute("alink", Services.prefs.getCharPref("editor.active_link_color"));
       bodyelement.setAttribute("vlink", Services.prefs.getCharPref("editor.followed_link_color"));
     }
     // Default image is independent of Custom colors???
     try {
       let background_image = Services.prefs.getCharPref("editor.default_background_image");
       if (background_image)
         editor.setAttributeOrEquivalent(bodyelement, "background", background_image, true);
-    } catch (e) {dump("BACKGROUND EXCEPTION: "+e+"\n"); }
-
+    } catch (e) { dump("BACKGROUND EXCEPTION: " + e + "\n"); }
   }
   // auto-save???
 }
 
-function GetBodyElement()
-{
+function GetBodyElement() {
   try {
     return GetCurrentEditor().rootElement;
-  }
-  catch (ex) {
+  } catch (ex) {
     dump("no body tag found?!\n");
     //  better have one, how can we blow things up here?
   }
   return null;
 }
 
 // --------------------------- Logging stuff ---------------------------
 
-function EditorGetNodeFromOffsets(offsets)
-{
+function EditorGetNodeFromOffsets(offsets) {
   var node = null;
   try {
     node = GetCurrentEditor().document;
 
     for (var i = 0; i < offsets.length; i++)
       node = node.childNodes[offsets[i]];
   } catch (e) {}
   return node;
 }
 
-function EditorSetSelectionFromOffsets(selRanges)
-{
+function EditorSetSelectionFromOffsets(selRanges) {
   try {
     var editor = GetCurrentEditor();
     var selection = editor.selection;
     selection.removeAllRanges();
 
     var rangeArr, start, end, node, offset;
-    for (var i = 0; i < selRanges.length; i++)
-    {
+    for (var i = 0; i < selRanges.length; i++) {
       rangeArr = selRanges[i];
       start    = rangeArr[0];
       end      = rangeArr[1];
 
       var range = editor.document.createRange();
 
       node   = EditorGetNodeFromOffsets(start[0]);
       offset = start[1];
@@ -2430,375 +2198,331 @@ function EditorSetSelectionFromOffsets(s
 
       range.setEnd(node, offset);
 
       selection.addRange(range);
     }
   } catch (e) {}
 }
 
-//--------------------------------------------------------------------
-function initFontStyleMenu(menuPopup)
-{
-  for (var i = 0; i < menuPopup.childNodes.length; i++)
-  {
+// --------------------------------------------------------------------
+function initFontStyleMenu(menuPopup) {
+  for (var i = 0; i < menuPopup.childNodes.length; i++) {
     var menuItem = menuPopup.childNodes[i];
     var theStyle = menuItem.getAttribute("state");
-    if (theStyle)
-    {
+    if (theStyle) {
       menuItem.setAttribute("checked", theStyle);
     }
   }
 }
 
-//--------------------------------------------------------------------
-function onButtonUpdate(button, commmandID)
-{
+// --------------------------------------------------------------------
+function onButtonUpdate(button, commmandID) {
   var commandNode = document.getElementById(commmandID);
   var state = commandNode.getAttribute("state");
   button.checked = state == "true";
 }
 
-//--------------------------------------------------------------------
-function onStateButtonUpdate(button, commmandID, onState)
-{
+// --------------------------------------------------------------------
+function onStateButtonUpdate(button, commmandID, onState) {
   var commandNode = document.getElementById(commmandID);
   var state = commandNode.getAttribute("state");
 
   button.checked = state == onState;
 }
 
 // --------------------------- Status calls ---------------------------
-function getColorAndSetColorWell(ColorPickerID, ColorWellID)
-{
+function getColorAndSetColorWell(ColorPickerID, ColorWellID) {
   var colorWell;
   if (ColorWellID)
     colorWell = document.getElementById(ColorWellID);
 
   var colorPicker = document.getElementById(ColorPickerID);
-  if (colorPicker)
-  {
+  if (colorPicker) {
     // Extract color from colorPicker and assign to colorWell.
     var color = colorPicker.getAttribute("color");
 
-    if (colorWell && color)
-    {
+    if (colorWell && color) {
       // Use setAttribute so colorwell can be a XUL element, such as button
       colorWell.setAttribute("style", "background-color: " + color);
     }
   }
   return color;
 }
 
-//-----------------------------------------------------------------------------------
-function IsSpellCheckerInstalled()
-{
+// -----------------------------------------------------------------------------------
+function IsSpellCheckerInstalled() {
   return true;  // Always installed.
 }
 
-//-----------------------------------------------------------------------------------
-function IsFindInstalled()
-{
+// -----------------------------------------------------------------------------------
+function IsFindInstalled() {
   return "@mozilla.org/embedcomp/rangefind;1" in Cc
           && "@mozilla.org/find/find_service;1" in Cc;
 }
 
-//-----------------------------------------------------------------------------------
-function RemoveInapplicableUIElements()
-{
+// -----------------------------------------------------------------------------------
+function RemoveInapplicableUIElements() {
   // For items that are in their own menu block, remove associated separator
   // (we can't use "hidden" since class="hide-in-IM" CSS rule interferes)
 
    // if no find, remove find ui
-  if (!IsFindInstalled())
-  {
+  if (!IsFindInstalled()) {
     HideItem("menu_find");
     HideItem("menu_findnext");
     HideItem("menu_replace");
     HideItem("menu_find");
     RemoveItem("sep_find");
   }
 
    // if no spell checker, remove spell checker ui
-  if (!IsSpellCheckerInstalled())
-  {
+  if (!IsSpellCheckerInstalled()) {
     HideItem("spellingButton");
     HideItem("menu_checkspelling");
     RemoveItem("sep_checkspelling");
   }
 
   // Remove menu items (from overlay shared with HTML editor) in non-HTML.
-  if (!IsHTMLEditor())
-  {
+  if (!IsHTMLEditor()) {
     HideItem("insertAnchor");
     HideItem("insertImage");
     HideItem("insertHline");
     HideItem("insertTable");
     HideItem("insertHTML");
     HideItem("insertFormMenu");
     HideItem("fileExportToText");
     HideItem("viewFormatToolbar");
     HideItem("viewEditModeToolbar");
   }
 }
 
-function HideItem(id)
-{
+function HideItem(id) {
   var item = document.getElementById(id);
   if (item)
     item.hidden = true;
 }
 
-function RemoveItem(id)
-{
+function RemoveItem(id) {
   var item = document.getElementById(id);
   if (item)
     item.remove();
 }
 
 // Command Updating Strategy:
 //   Don't update on on selection change, only when menu is displayed,
 //   with this "oncreate" handler:
-function EditorInitTableMenu()
-{
+function EditorInitTableMenu() {
   try {
     InitJoinCellMenuitem("menu_JoinTableCells");
   } catch (ex) {}
 
   // Set enable states for all table commands
   goUpdateTableMenuItems(document.getElementById("composerTableMenuItems"));
 }
 
-function InitJoinCellMenuitem(id)
-{
+function InitJoinCellMenuitem(id) {
   // Change text on the "Join..." item depending if we
   //   are joining selected cells or just cell to right
   // TODO: What to do about normal selection that crosses
   //       table border? Try to figure out all cells
   //       included in the selection?
   var menuText;
   var menuItem = document.getElementById(id);
   if (!menuItem) return;
 
   // Use "Join selected cells if there's more than 1 cell selected
   var numSelected;
   var foundElement;
 
   try {
     var tagNameObj = {};
-    var countObj = {value:0}
+    var countObj = {value: 0};
     foundElement = GetCurrentTableEditor().getSelectedOrParentTableElement(tagNameObj, countObj);
-    numSelected = countObj.value
-  }
-  catch(e) {}
+    numSelected = countObj.value;
+  } catch (e) {}
   if (foundElement && numSelected > 1)
     menuText = GetString("JoinSelectedCells");
   else
     menuText = GetString("JoinCellToRight");
 
-  menuItem.setAttribute("label",menuText);
-  menuItem.setAttribute("accesskey",GetString("JoinCellAccesskey"));
+  menuItem.setAttribute("label", menuText);
+  menuItem.setAttribute("accesskey", GetString("JoinCellAccesskey"));
 }
 
-function InitRemoveStylesMenuitems(removeStylesId, removeLinksId, removeNamedAnchorsId)
-{
+function InitRemoveStylesMenuitems(removeStylesId, removeLinksId, removeNamedAnchorsId) {
   var editor = GetCurrentEditor();
   if (!editor)
     return;
 
   // Change wording of menuitems depending on selection
   var stylesItem = document.getElementById(removeStylesId);
   var linkItem = document.getElementById(removeLinksId);
 
   var isCollapsed = editor.selection.isCollapsed;
-  if (stylesItem)
-  {
+  if (stylesItem) {
     stylesItem.setAttribute("label", isCollapsed ? GetString("StopTextStyles") : GetString("RemoveTextStyles"));
     stylesItem.setAttribute("accesskey", GetString("RemoveTextStylesAccesskey"));
   }
-  if (linkItem)
-  {
+  if (linkItem) {
     linkItem.setAttribute("label", isCollapsed ? GetString("StopLinks") : GetString("RemoveLinks"));
     linkItem.setAttribute("accesskey", GetString("RemoveLinksAccesskey"));
     // Note: disabling text style is a pain since there are so many - forget it!
 
     // Disable if not in a link, but always allow "Remove"
     //  if selection isn't collapsed since we only look at anchor node
     try {
       SetElementEnabled(linkItem, !isCollapsed ||
                       editor.getElementOrParentByTagName("href", null));
-    } catch(e) {}
+    } catch (e) {}
   }
   // Disable if selection is collapsed
   SetElementEnabledById(removeNamedAnchorsId, !isCollapsed);
 }
 
-function goUpdateTableMenuItems(commandset)
-{
+function goUpdateTableMenuItems(commandset) {
   var editor = GetCurrentTableEditor();
-  if (!editor)
-  {
+  if (!editor) {
     dump("goUpdateTableMenuItems: too early, not initialized\n");
     return;
   }
 
   var enabled = false;
   var enabledIfTable = false;
 
   var flags = editor.flags;
   if (!(flags & nsIPlaintextEditor.eEditorReadonlyMask) &&
-      IsEditingRenderedHTML())
-  {
+      IsEditingRenderedHTML()) {
     var tagNameObj = { value: "" };
     var element;
     try {
-      element = editor.getSelectedOrParentTableElement(tagNameObj, {value:0});
-    }
-    catch(e) {}
-
-    if (element)
-    {
+      element = editor.getSelectedOrParentTableElement(tagNameObj, {value: 0});
+    } catch (e) {}
+
+    if (element) {
       // Value when we need to have a selected table or inside a table
       enabledIfTable = true;
 
       // All others require being inside a cell or selected cell
       enabled = (tagNameObj.value == "td");
     }
   }
 
   // Loop through command nodes
-  for (var i = 0; i < commandset.childNodes.length; i++)
-  {
+  for (var i = 0; i < commandset.childNodes.length; i++) {
     var commandID = commandset.childNodes[i].getAttribute("id");
-    if (commandID)
-    {
+    if (commandID) {
       if (commandID == "cmd_InsertTable" ||
           commandID == "cmd_JoinTableCells" ||
           commandID == "cmd_SplitTableCell" ||
-          commandID == "cmd_ConvertToTable")
-      {
+          commandID == "cmd_ConvertToTable") {
         // Call the update method in the command class
         goUpdateCommand(commandID);
       }
       // Directly set with the values calculated here
       else if (commandID == "cmd_DeleteTable" ||
                commandID == "cmd_NormalizeTable" ||
                commandID == "cmd_editTable" ||
                commandID == "cmd_TableOrCellColor" ||
-               commandID == "cmd_SelectTable")
-      {
+               commandID == "cmd_SelectTable") {
         goSetCommandEnabled(commandID, enabledIfTable);
       } else {
         goSetCommandEnabled(commandID, enabled);
       }
     }
   }
 }
 
-//-----------------------------------------------------------------------------------
+// -----------------------------------------------------------------------------------
 // Helpers for inserting and editing tables:
 
-function IsInTable()
-{
+function IsInTable() {
   var editor = GetCurrentEditor();
   try {
     var flags = editor.flags;
     return (IsHTMLEditor() &&
             !(flags & nsIPlaintextEditor.eEditorReadonlyMask) &&
             IsEditingRenderedHTML() &&
             null != editor.getElementOrParentByTagName("table", null));
   } catch (e) {}
   return false;
 }
 
-function IsInTableCell()
-{
+function IsInTableCell() {
   try {
     var editor = GetCurrentEditor();
     var flags = editor.flags;
     return (IsHTMLEditor() &&
             !(flags & nsIPlaintextEditor.eEditorReadonlyMask) &&
             IsEditingRenderedHTML() &&
             null != editor.getElementOrParentByTagName("td", null));
   } catch (e) {}
   return false;
-
 }
 
-function IsSelectionInOneCell()
-{
+function IsSelectionInOneCell() {
   try {
     var editor = GetCurrentEditor();
     var selection = editor.selection;
 
-    if (selection.rangeCount == 1)
-    {
+    if (selection.rangeCount == 1) {
       // We have a "normal" single-range selection
       if (!selection.isCollapsed &&
-         selection.anchorNode != selection.focusNode)
-      {
+         selection.anchorNode != selection.focusNode) {
         // Check if both nodes are within the same cell
         var anchorCell = editor.getElementOrParentByTagName("td", selection.anchorNode);
         var focusCell = editor.getElementOrParentByTagName("td", selection.focusNode);
         return (focusCell != null && anchorCell != null && (focusCell == anchorCell));
       }
       // Collapsed selection or anchor == focus (thus must be in 1 cell)
       return true;
     }
   } catch (e) {}
   return false;
 }
 
 // Call this with insertAllowed = true to allow inserting if not in existing table,
 //   else use false to do nothing if not in a table
-function EditorInsertOrEditTable(insertAllowed)
-{
-  if (IsInTable())
-  {
+function EditorInsertOrEditTable(insertAllowed) {
+  if (IsInTable()) {
     // Edit properties of existing table
-    window.openDialog("chrome://editor/content/EdTableProps.xul", "_blank", "chrome,close,titlebar,modal", "","TablePanel");
+    window.openDialog("chrome://editor/content/EdTableProps.xul", "_blank", "chrome,close,titlebar,modal", "", "TablePanel");
     gContentWindow.focus();
-  }
-  else if (insertAllowed)
-  {
+  } else if (insertAllowed) {
     try {
       if (GetCurrentEditor().selection.isCollapsed)
         // If we have a caret, insert a blank table...
         EditorInsertTable();
       else
         // else convert the selection into a table
         goDoCommand("cmd_ConvertToTable");
     } catch (e) {}
   }
 }
 
-function EditorInsertTable()
-{
+function EditorInsertTable() {
   // Insert a new table
   window.openDialog("chrome://editor/content/EdInsertTable.xul", "_blank", "chrome,close,titlebar,modal", "");
   gContentWindow.focus();
 }
 
-function EditorTableCellProperties()
-{
+function EditorTableCellProperties() {
   if (!IsHTMLEditor())
     return;
 
   try {
     var cell = GetCurrentEditor().getElementOrParentByTagName("td", null);
     if (cell) {
       // Start Table Properties dialog on the "Cell" panel
       window.openDialog("chrome://editor/content/EdTableProps.xul", "_blank", "chrome,close,titlebar,modal", "", "CellPanel");
       gContentWindow.focus();
     }
   } catch (e) {}
 }
 
-function GetNumberOfContiguousSelectedRows()
-{
+function GetNumberOfContiguousSelectedRows() {
   if (!IsHTMLEditor())
     return 0;
 
   var rows = 0;
   try {
     var editor = GetCurrentTableEditor();
     var rowObj = { value: 0 };
     var colObj = { value: 0 };
@@ -2806,36 +2530,33 @@ function GetNumberOfContiguousSelectedRo
     if (!cell)
       return 0;
 
     // We have at least one row
     rows++;
 
     var lastIndex = rowObj.value;
     do {
-      cell = editor.getNextSelectedCell({value:0});
-      if (cell)
-      {
+      cell = editor.getNextSelectedCell({value: 0});
+      if (cell) {
         editor.getCellIndexes(cell, rowObj, colObj);
         var index = rowObj.value;
-        if (index == lastIndex + 1)
-        {
+        if (index == lastIndex + 1) {
           lastIndex = index;
           rows++;
         }
       }
     }
     while (cell);
   } catch (e) {}
 
   return rows;
 }
 
-function GetNumberOfContiguousSelectedColumns()
-{
+function GetNumberOfContiguousSelectedColumns() {
   if (!IsHTMLEditor())
     return 0;
 
   var columns = 0;
   try {
     var editor = GetCurrentTableEditor();
     var colObj = { value: 0 };
     var rowObj = { value: 0 };
@@ -2843,161 +2564,137 @@ function GetNumberOfContiguousSelectedCo
     if (!cell)
       return 0;
 
     // We have at least one column
     columns++;
 
     var lastIndex = colObj.value;
     do {
-      cell = editor.getNextSelectedCell({value:0});
-      if (cell)
-      {
+      cell = editor.getNextSelectedCell({value: 0});
+      if (cell) {
         editor.getCellIndexes(cell, rowObj, colObj);
         var index = colObj.value;
-        if (index == lastIndex +1)
-        {
+        if (index == lastIndex + 1) {
           lastIndex = index;
           columns++;
         }
       }
     }
     while (cell);
   } catch (e) {}
 
   return columns;
 }
 
-function EditorOnFocus()
-{
+function EditorOnFocus() {
   // Current window already has the InsertCharWindow
   if ("InsertCharWindow" in window && window.InsertCharWindow) return;
 
   // Find window with an InsertCharsWindow and switch association to this one
   var windowWithDialog = FindEditorWithInsertCharDialog();
-  if (windowWithDialog)
-  {
+  if (windowWithDialog) {
     // Switch the dialog to current window
     // this sets focus to dialog, so bring focus back to editor window
     if (SwitchInsertCharToThisWindow(windowWithDialog))
       top.document.commandDispatcher.focusedWindow.focus();
   }
 }
 
-function SwitchInsertCharToThisWindow(windowWithDialog)
-{
+function SwitchInsertCharToThisWindow(windowWithDialog) {
   if (windowWithDialog && "InsertCharWindow" in windowWithDialog &&
-      windowWithDialog.InsertCharWindow)
-  {
+      windowWithDialog.InsertCharWindow) {
     // Move dialog association to the current window
     window.InsertCharWindow = windowWithDialog.InsertCharWindow;
     windowWithDialog.InsertCharWindow = null;
 
     // Switch the dialog's opener to current window's
     window.InsertCharWindow.opener = window;
 
     // Bring dialog to the foreground
     window.InsertCharWindow.focus();
     return true;
   }
   return false;
 }
 
-function FindEditorWithInsertCharDialog()
-{
+function FindEditorWithInsertCharDialog() {
   try {
     // Find window with an InsertCharsWindow and switch association to this one
     let enumerator = Services.wm.getEnumerator(null);
 
-    while (enumerator.hasMoreElements())
-    {
+    while (enumerator.hasMoreElements()) {
       var tempWindow = enumerator.getNext();
 
       if (tempWindow != window && "InsertCharWindow" in tempWindow &&
-          tempWindow.InsertCharWindow)
-      {
+          tempWindow.InsertCharWindow) {
         return tempWindow;
       }
     }
-  }
-  catch(e) {}
+  } catch (e) {}
   return null;
 }
 
-function EditorFindOrCreateInsertCharWindow()
-{
+function EditorFindOrCreateInsertCharWindow() {
   if ("InsertCharWindow" in window && window.InsertCharWindow)
     window.InsertCharWindow.focus();
-  else
-  {
+  else {
     // Since we switch the dialog during EditorOnFocus(),
     //   this should really never be found, but it's good to be sure
     var windowWithDialog = FindEditorWithInsertCharDialog();
-    if (windowWithDialog)
-    {
+    if (windowWithDialog) {
       SwitchInsertCharToThisWindow(windowWithDialog);
-    }
-    else
-    {
+    } else {
       // The dialog will set window.InsertCharWindow to itself
       window.openDialog("chrome://editor/content/EdInsertChars.xul", "_blank", "chrome,close,titlebar", "");
     }
   }
 }
 
 // Find another HTML editor window to associate with the InsertChar dialog
 //   or close it if none found  (May be a mail composer)
-function SwitchInsertCharToAnotherEditorOrClose()
-{
-  if ("InsertCharWindow" in window && window.InsertCharWindow)
-  {
+function SwitchInsertCharToAnotherEditorOrClose() {
+  if ("InsertCharWindow" in window && window.InsertCharWindow) {
     var enumerator;
     try {
       enumerator = Services.wm.getEnumerator(null);
-    }
-    catch(e) {}
+    } catch (e) {}
     if (!enumerator) return;
 
     // TODO: Fix this to search for command controllers and look for "cmd_InsertChars"
     // For now, detect just Web Composer and HTML Mail Composer
-    while ( enumerator.hasMoreElements()  )
-    {
-      var  tempWindow = enumerator.getNext();
+    while (enumerator.hasMoreElements()) {
+      var tempWindow = enumerator.getNext();
       if (tempWindow != window && tempWindow != window.InsertCharWindow &&
-          "GetCurrentEditor" in tempWindow && tempWindow.GetCurrentEditor())
-      {
+          "GetCurrentEditor" in tempWindow && tempWindow.GetCurrentEditor()) {
         tempWindow.InsertCharWindow = window.InsertCharWindow;
         window.InsertCharWindow = null;
         tempWindow.InsertCharWindow.opener = tempWindow;
         return;
       }
     }
     // Didn't find another editor - close the dialog
     window.InsertCharWindow.close();
   }
 }
 
-function ResetStructToolbar()
-{
+function ResetStructToolbar() {
   gLastFocusNode = null;
   UpdateStructToolbar();
 }
 
-function newCommandListener(element)
-{
+function newCommandListener(element) {
   return function() { return SelectFocusNodeAncestor(element); };
 }
 
-function newContextmenuListener(button, element)
-{
+function newContextmenuListener(button, element) {
   return function() { return InitStructBarContextMenu(button, element); };
 }
 
-function UpdateStructToolbar()
-{
+function UpdateStructToolbar() {
   var editor = GetCurrentEditor();
   if (!editor) return;
 
   var mixed = GetSelectionContainer();
   if (!mixed) return;
   var element = mixed.node;
   var oneElementSelected = mixed.oneElementSelected;
 
@@ -3014,82 +2711,77 @@ function UpdateStructToolbar()
   if (!toolbar) return;
   // We need to leave the <label> to flex the buttons to the left.
   for (let node of toolbar.querySelectorAll("toolbarbutton")) {
     node.remove();
   }
 
   toolbar.removeAttribute("label");
 
-  if ( IsInHTMLSourceMode() ) {
+  if (IsInHTMLSourceMode()) {
     // we have destroyed the contents of the status bar and are
     // about to recreate it ; but we don't want to do that in
     // Source mode
     return;
   }
 
   var tag, button;
   var bodyElement = GetBodyElement();
   var isFocusNode = true;
   var tmp;
   do {
     tag = element.nodeName.toLowerCase();
 
     button = document.createElementNS(XUL_NS, "toolbarbutton");
-    button.setAttribute("label",   "<" + tag + ">");
-    button.setAttribute("value",   tag);
+    button.setAttribute("label", "<" + tag + ">");
+    button.setAttribute("value", tag);
     button.setAttribute("context", "structToolbarContext");
     button.className = "struct-button";
 
     toolbar.insertBefore(button, toolbar.firstChild);
 
     button.addEventListener("command", newCommandListener(element));
 
     button.addEventListener("contextmenu", newContextmenuListener(button, element));
 
     if (isFocusNode && oneElementSelected) {
       button.setAttribute("checked", "true");
       isFocusNode = false;
     }
 
     tmp = element;
     element = element.parentNode;
-
   } while (tmp != bodyElement);
 }
 
-function SelectFocusNodeAncestor(element)
-{
+function SelectFocusNodeAncestor(element) {
   var editor = GetCurrentEditor();
   if (editor) {
     if (element == GetBodyElement())
       editor.selectAll();
     else
       editor.selectElement(element);
   }
   ResetStructToolbar();
 }
 
-function GetSelectionContainer()
-{
+function GetSelectionContainer() {
   var editor = GetCurrentEditor();
   if (!editor) return null;
 
   try {
     var selection = editor.selection;
     if (!selection) return null;
-  }
-  catch (e) { return null; }
-
-  var result = { oneElementSelected:false };
+  } catch (e) { return null; }
+
+  var result = { oneElementSelected: false };
 
   if (selection.isCollapsed) {
     result.node = selection.focusNode;
-  }
-  else {
+  } else {
     var rangeCount = selection.rangeCount;
     if (rangeCount == 1) {
       result.node = editor.getSelectedElement("");
       var range = selection.getRangeAt(0);
 
       // check for a weird case : when we select a piece of text inside
       // a text node and apply an inline style to it, the selection starts
       // at the end of the text node preceding the style and ends after the
@@ -3102,30 +2794,27 @@ function GetSelectionContainer()
           range.endOffset == range.endContainer.length &&
           range.endContainer.nextSibling == null &&
           range.startContainer.nextSibling == range.endContainer.parentNode)
         result.node = range.endContainer.parentNode;
 
       if (!result.node) {
         // let's rely on the common ancestor of the selection
         result.node = range.commonAncestorContainer;
-      }
-      else {
+      } else {
         result.oneElementSelected = true;
       }
-    }
-    else {
+    } else {
       // assume table cells !
       var i, container = null;
       for (i = 0; i < rangeCount; i++) {
         range = selection.getRangeAt(i);
         if (!container) {
           container = range.startContainer;
-        }
-        else if (container != range.startContainer) {
+        } else if (container != range.startContainer) {
           // all table cells don't belong to same row so let's
           // select the parent of all rows
           result.node = container.parentNode;
           break;
         }
         result.node = container;
       }
     }
@@ -3140,18 +2829,17 @@ function GetSelectionContainer()
   // and don't select anonymous content !!! (fix for bug 190279)
   while (result.node.hasAttribute("_moz_editor_bogus_node") ||
          editor.isAnonymousElement(result.node))
     result.node = result.node.parentNode;
 
   return result;
 }
 
-function FillInHTMLTooltipEditor(tooltip)
-{
+function FillInHTMLTooltipEditor(tooltip) {
   const XLinkNS = "http://www.w3.org/1999/xlink";
   var tooltipText = null;
   var node;
   if (IsInPreviewMode()) {
     for (node = document.tooltipNode; node; node = node.parentNode) {
       if (node.nodeType == Node.ELEMENT_NODE) {
         tooltipText = node.getAttributeNS(XLinkNS, "title");
         if (tooltipText && /\S/.test(tooltipText)) {
@@ -3176,45 +2864,41 @@ function FillInHTMLTooltipEditor(tooltip
         tooltip.setAttribute("label", tooltipText);
         return true;
       }
     }
   }
   return false;
 }
 
-function UpdateTOC()
-{
+function UpdateTOC() {
   window.openDialog("chrome://editor/content/EdInsertTOC.xul",
                     "_blank", "chrome,close,modal,titlebar");
   window.content.focus();
 }
 
-function InitTOCMenu()
-{
+function InitTOCMenu() {
   var elt = GetCurrentEditor().document.getElementById("mozToc");
   var createMenuitem = document.getElementById("insertTOCMenuitem");
   var updateMenuitem = document.getElementById("updateTOCMenuitem");
   var removeMenuitem = document.getElementById("removeTOCMenuitem");
   if (removeMenuitem && createMenuitem && updateMenuitem) {
     if (elt) {
       createMenuitem.setAttribute("disabled", "true");
       updateMenuitem.removeAttribute("disabled");
       removeMenuitem.removeAttribute("disabled");
-    }
-    else {
+    } else {
       createMenuitem.removeAttribute("disabled");
       removeMenuitem.setAttribute("disabled", "true");
       updateMenuitem.setAttribute("disabled", "true");
     }
   }
 }
 
-function RemoveTOC()
-{
+function RemoveTOC() {
   var theDocument = GetCurrentEditor().document;
   var elt = theDocument.getElementById("mozToc");
   if (elt) {
     elt.remove();
   }
 
   let anchorNodes = theDocument.querySelectorAll('a[name^="mozTocId"]');
   for (let node of anchorNodes) {
--- a/editor/ui/composer/content/editorUtilities.js
+++ b/editor/ui/composer/content/editorUtilities.js
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
-/**** NAMESPACES ****/
+/** ** NAMESPACES ****/
 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
 // Each editor window must include this file
 // Variables  shared by all dialogs:
 
 // Object to attach commonly-used widgets (all dialogs should use this)
 var gDialog = {};
 
@@ -21,174 +21,157 @@ var kOutputEncodeW3CEntities = Ci.nsIDoc
 var kOutputFormatted = Ci.nsIDocumentEncoder.OutputFormatted;
 var kOutputLFLineBreak = Ci.nsIDocumentEncoder.OutputLFLineBreak;
 var kOutputSelectionOnly = Ci.nsIDocumentEncoder.OutputSelectionOnly;
 var kOutputWrap = Ci.nsIDocumentEncoder.OutputWrap;
 
 var gStringBundle;
 var gFilePickerDirectory;
 
-/************* Message dialogs ***************/
+/** *********** Message dialogs ***************/
 
 // Optional: Caller may supply text to substitute for "Ok" and/or "Cancel"
-function ConfirmWithTitle(title, message, okButtonText, cancelButtonText)
-{
+function ConfirmWithTitle(title, message, okButtonText, cancelButtonText) {
   let okFlag = okButtonText ? Services.prompt.BUTTON_TITLE_IS_STRING : Services.prompt.BUTTON_TITLE_OK;
   let cancelFlag = cancelButtonText ? Services.prompt.BUTTON_TITLE_IS_STRING : Services.prompt.BUTTON_TITLE_CANCEL;
 
   return Services.prompt.confirmEx(window, title, message,
                                    (okFlag * Services.prompt.BUTTON_POS_0) +
                                    (cancelFlag * Services.prompt.BUTTON_POS_1),
-                                   okButtonText, cancelButtonText, null, null, {value:0}) == 0;
+                                   okButtonText, cancelButtonText, null, null, {value: 0}) == 0;
 }
 
-/************* String Utilities ***************/
+/** *********** String Utilities ***************/
 
-function GetString(name)
-{
-  if (!gStringBundle)
-  {
+function GetString(name) {
+  if (!gStringBundle) {
     try {
       gStringBundle = Services.strings.createBundle("chrome://editor/locale/editor.properties");
     } catch (ex) {}
   }
-  if (gStringBundle)
-  {
+  if (gStringBundle) {
     try {
       return gStringBundle.GetStringFromName(name);
     } catch (e) {}
   }
   return null;
 }
 
-function GetFormattedString(aName, aVal)
-{
-  if (!gStringBundle)
-  {
+function GetFormattedString(aName, aVal) {
+  if (!gStringBundle) {
     try {
       gStringBundle = Services.strings.createBundle("chrome://editor/locale/editor.properties");
     } catch (ex) {}
   }
-  if (gStringBundle)
-  {
+  if (gStringBundle) {
     try {
       return gStringBundle.formatStringFromName(aName, [aVal], 1);
     } catch (e) {}
   }
   return null;
 }
 
-function TrimStringLeft(string)
-{
+function TrimStringLeft(string) {
   if (!string)
     return "";
   return string.trimLeft();
 }
 
-function TrimStringRight(string)
-{
+function TrimStringRight(string) {
   if (!string)
     return "";
   return string.trimRight();
 }
 
 // Remove whitespace from both ends of a string
-function TrimString(string)
-{
+function TrimString(string) {
   if (!string)
     return "";
   return string.trim();
 }
 
-function TruncateStringAtWordEnd(string, maxLength, addEllipses)
-{
+function TruncateStringAtWordEnd(string, maxLength, addEllipses) {
   // Return empty if string is null, undefined, or the empty string
   if (!string)
     return "";
 
   // We assume they probably don't want whitespace at the beginning
   string = string.trimLeft();
   if (string.length <= maxLength)
     return string;
 
   // We need to truncate the string to maxLength or fewer chars
   if (addEllipses)
     maxLength -= 3;
-  string = string.replace(RegExp("(.{0," + maxLength + "})\\s.*"), "$1")
+  string = string.replace(RegExp("(.{0," + maxLength + "})\\s.*"), "$1");
 
   if (string.length > maxLength)
     string = string.slice(0, maxLength);
 
   if (addEllipses)
     string += "...";
   return string;
 }
 
 // Replace all whitespace characters with supplied character
 // E.g.: Use charReplace = " ", to "unwrap" the string by removing line-end chars
 //       Use charReplace = "_" when you don't want spaces (like in a URL)
-function ReplaceWhitespace(string, charReplace)
-{
+function ReplaceWhitespace(string, charReplace) {
   return string.trim().replace(/\s+/g, charReplace);
 }
 
 // Replace whitespace with "_" and allow only HTML CDATA
 //   characters: "a"-"z","A"-"Z","0"-"9", "_", ":", "-", ".",
 //   and characters above ASCII 127
-function ConvertToCDATAString(string)
-{
-  return string.replace(/\s+/g,"_").replace(/[^a-zA-Z0-9_\.\-\:\u0080-\uFFFF]+/g,'');
+function ConvertToCDATAString(string) {
+  return string.replace(/\s+/g, "_").replace(/[^a-zA-Z0-9_\.\-\:\u0080-\uFFFF]+/g, "");
 }
 
-function GetSelectionAsText()
-{
+function GetSelectionAsText() {
   try {
     return GetCurrentEditor().outputToString("text/plain", kOutputSelectionOnly);
   } catch (e) {}
 
   return "";
 }
 
 
-/************* Get Current Editor and associated interfaces or info ***************/
+/** *********** Get Current Editor and associated interfaces or info ***************/
 const nsIPlaintextEditor = Ci.nsIPlaintextEditor;
 const nsIHTMLEditor = Ci.nsIHTMLEditor;
 const nsITableEditor = Ci.nsITableEditor;
 const nsIEditorStyleSheets = Ci.nsIEditorStyleSheets;
 const nsIEditingSession = Ci.nsIEditingSession;
 
-function GetCurrentEditor()
-{
+function GetCurrentEditor() {
   // Get the active editor from the <editor> tag
   // XXX This will probably change if we support > 1 editor in main Composer window
   //      (e.g. a plaintext editor for HTMLSource)
 
   // For dialogs: Search up parent chain to find top window with editor
   var editor;
   try {
     var editorElement = GetCurrentEditorElement();
     editor = editorElement.getEditor(editorElement.contentWindow);
 
     // Do QIs now so editor users won't have to figure out which interface to use
     // Using "instanceof" does the QI for us.
     editor instanceof Ci.nsIPlaintextEditor;
     editor instanceof Ci.nsIHTMLEditor;
-  } catch (e) { dump (e)+"\n"; }
+  } catch (e) { dump(e) + "\n"; }
 
   return editor;
 }
 
-function GetCurrentTableEditor()
-{
+function GetCurrentTableEditor() {
   var editor = GetCurrentEditor();
   return (editor && (editor instanceof nsITableEditor)) ? editor : null;
 }
 
-function GetCurrentEditorElement()
-{
+function GetCurrentEditorElement() {
   var tmpWindow = window;
 
   do {
     // Get the <editor> element(s)
     let editorItem = tmpWindow.document.querySelector("editor");
 
     // This will change if we support > 1 editor element
     if (editorItem)
@@ -196,239 +179,202 @@ function GetCurrentEditorElement()
 
     tmpWindow = tmpWindow.opener;
   }
   while (tmpWindow);
 
   return null;
 }
 
-function GetCurrentCommandManager()
-{
+function GetCurrentCommandManager() {
   try {
     return GetCurrentEditorElement().commandManager;
-  } catch (e) { dump (e)+"\n"; }
+  } catch (e) { dump(e) + "\n"; }
 
   return null;
 }
 
-function GetCurrentEditorType()
-{
+function GetCurrentEditorType() {
   try {
     return GetCurrentEditorElement().editortype;
-  } catch (e) { dump (e)+"\n"; }
+  } catch (e) { dump(e) + "\n"; }
 
   return "";
 }
 
-function IsHTMLEditor()
-{
+function IsHTMLEditor() {
   // We don't have an editorElement, just return false
   if (!GetCurrentEditorElement())
     return false;
 
   var editortype = GetCurrentEditorType();
-  switch (editortype)
-  {
+  switch (editortype) {
       case "html":
       case "htmlmail":
         return true;
 
       case "text":
       case "textmail":
-        return false
+        return false;
 
       default:
         dump("INVALID EDITOR TYPE: " + editortype + "\n");
         break;
   }
   return false;
 }
 
-function PageIsEmptyAndUntouched()
-{
+function PageIsEmptyAndUntouched() {
   return IsDocumentEmpty() && !IsDocumentModified() && !IsHTMLSourceChanged();
 }
 
-function IsInHTMLSourceMode()
-{
+function IsInHTMLSourceMode() {
   return (gEditorDisplayMode == kDisplayModeSource);
 }
 
-function IsInPreviewMode()
-{
+function IsInPreviewMode() {
   return (gEditorDisplayMode == kDisplayModePreview);
 }
 
 // are we editing HTML (i.e. neither in HTML source mode, nor editing a text file)
-function IsEditingRenderedHTML()
-{
+function IsEditingRenderedHTML() {
   return IsHTMLEditor() && !IsInHTMLSourceMode();
 }
 
-function IsWebComposer()
-{
+function IsWebComposer() {
   return document.documentElement.id == "editorWindow";
 }
 
-function IsDocumentEditable()
-{
+function IsDocumentEditable() {
   try {
     return GetCurrentEditor().isDocumentEditable;
   } catch (e) {}
   return false;
 }
 
-function IsDocumentEmpty()
-{
+function IsDocumentEmpty() {
   try {
     return GetCurrentEditor().documentIsEmpty;
   } catch (e) {}
   return false;
 }
 
-function IsDocumentModified()
-{
+function IsDocumentModified() {
   try {
     return GetCurrentEditor().documentModified;
   } catch (e) {}
   return false;
 }
 
-function IsHTMLSourceChanged()
-{
+function IsHTMLSourceChanged() {
   // gSourceTextEditor will not be defined if we're just a text editor.
   return gSourceTextEditor ? gSourceTextEditor.documentModified : false;
 }
 
-function newCommandParams()
-{
+function newCommandParams() {
   try {
     return Cu.createCommandParams();
-  }
-  catch(e) { dump("error thrown in newCommandParams: "+e+"\n"); }
+  } catch (e) { dump("error thrown in newCommandParams: " + e + "\n"); }
   return null;
 }
 
-/************* General editing command utilities ***************/
+/** *********** General editing command utilities ***************/
 
-function GetDocumentTitle()
-{
+function GetDocumentTitle() {
   try {
     return new XPCNativeWrapper(GetCurrentEditor().document, "title").title;
   } catch (e) {}
 
   return "";
 }
 
-function SetDocumentTitle(title)
-{
-
+function SetDocumentTitle(title) {
   try {
     GetCurrentEditorElement().contentDocument.title = title;
 
     // Update window title (doesn't work if called from a dialog)
     if ("UpdateWindowTitle" in window)
       window.UpdateWindowTitle();
   } catch (e) {}
 }
 
-function EditorGetTextProperty(property, attribute, value, firstHas, anyHas, allHas)
-{
+function EditorGetTextProperty(property, attribute, value, firstHas, anyHas, allHas) {
   try {
     return GetCurrentEditor().getInlinePropertyWithAttrValue(property,
                                 attribute, value, firstHas, anyHas, allHas);
-  }
-  catch(e) {}
+  } catch (e) {}
 }
 
-function EditorSetTextProperty(property, attribute, value)
-{
+function EditorSetTextProperty(property, attribute, value) {
   try {
     GetCurrentEditor().setInlineProperty(property, attribute, value);
     if ("gContentWindow" in window)
       window.gContentWindow.focus();
-  }
-  catch(e) {}
+  } catch (e) {}
 }
 
-function EditorRemoveTextProperty(property, attribute)
-{
+function EditorRemoveTextProperty(property, attribute) {
   try {
     GetCurrentEditor().removeInlineProperty(property, attribute);
     if ("gContentWindow" in window)
       window.gContentWindow.focus();
-  }
-  catch(e) {}
+  } catch (e) {}
 }
 
-/************* Element enbabling/disabling ***************/
+/** *********** Element enbabling/disabling ***************/
 
 // this function takes an elementID and a flag
 // if the element can be found by ID, then it is either enabled (by removing "disabled" attr)
 // or disabled (setAttribute) as specified in the "doEnable" parameter
-function SetElementEnabledById(elementID, doEnable)
-{
+function SetElementEnabledById(elementID, doEnable) {
   SetElementEnabled(document.getElementById(elementID), doEnable);
 }
 
-function SetElementEnabled(element, doEnable)
-{
-  if ( element )
-  {
-    if ( doEnable )
+function SetElementEnabled(element, doEnable) {
+  if (element) {
+    if (doEnable)
       element.removeAttribute("disabled");
     else
       element.setAttribute("disabled", "true");
-  }
-  else
-  {
+  } else {
     dump("Element  not found in SetElementEnabled\n");
   }
 }
 
-/************* Services / Prefs ***************/
+/** *********** Services / Prefs ***************/
 
-function GetFileProtocolHandler()
-{
+function GetFileProtocolHandler() {
   let handler = Services.io.getProtocolHandler("file");
   return handler.QueryInterface(Ci.nsIFileProtocolHandler);
 }
 
-function SetStringPref(aPrefName, aPrefValue)
-{
+function SetStringPref(aPrefName, aPrefValue) {
   try {
     Services.prefs.setStringPref(aPrefName, aPrefValue);
-  }
-  catch(e) {}
+  } catch (e) {}
 }
 
 // Set initial directory for a filepicker from URLs saved in prefs
-function SetFilePickerDirectory(filePicker, fileType)
-{
-  if (filePicker)
-  {
+function SetFilePickerDirectory(filePicker, fileType) {
+  if (filePicker) {
     try {
       // Save current directory so we can reset it in SaveFilePickerDirectory
       gFilePickerDirectory = filePicker.displayDirectory;
 
-      let location = Services.prefs.getComplexValue("editor.lastFileLocation."+fileType,
+      let location = Services.prefs.getComplexValue("editor.lastFileLocation." + fileType,
                                                     Ci.nsIFile);
       if (location)
         filePicker.displayDirectory = location;
-    }
-    catch(e) {}
+    } catch (e) {}
   }
 }
 
 // Save the directory of the selected file to prefs
-function SaveFilePickerDirectory(filePicker, fileType)
-{
-  if (filePicker && filePicker.file)
-  {
+function SaveFilePickerDirectory(filePicker, fileType) {
+  if (filePicker && filePicker.file) {
     try {
       var fileDir;
       if (filePicker.file.parent)
         fileDir = filePicker.file.parent.QueryInterface(Ci.nsIFile);
 
         Services.prefs.setComplexValue("editor.lastFileLocation." + fileType,
                                        Ci.nsIFile, fileDir);
 
@@ -439,24 +385,22 @@ function SaveFilePickerDirectory(filePic
   // Restore the directory used before SetFilePickerDirectory was called;
   // This reduces interference with Browser and other module directory defaults
   if (gFilePickerDirectory)
     filePicker.displayDirectory = gFilePickerDirectory;
 
   gFilePickerDirectory = null;
 }
 
-function GetDefaultBrowserColors()
-{
-  var colors = { TextColor:0, BackgroundColor:0, LinkColor:0, ActiveLinkColor:0 , VisitedLinkColor:0 };
+function GetDefaultBrowserColors() {
+  var colors = { TextColor: 0, BackgroundColor: 0, LinkColor: 0, ActiveLinkColor: 0, VisitedLinkColor: 0 };
   var useSysColors = false;
   try { useSysColors = Services.prefs.getBoolPref("browser.display.use_system_colors"); } catch (e) {}
 
-  if (!useSysColors)
-  {
+  if (!useSysColors) {
     try { colors.TextColor = Services.prefs.getCharPref("browser.display.foreground_color"); } catch (e) {}
 
     try { colors.BackgroundColor = Services.prefs.getCharPref("browser.display.background_color"); } catch (e) {}
   }
   // Use OS colors for text and background if explicitly asked or pref is not set
   if (!colors.TextColor)
     colors.TextColor = "windowtext";
 
@@ -465,30 +409,27 @@ function GetDefaultBrowserColors()
 
   colors.LinkColor = Services.prefs.getCharPref("browser.anchor_color");
   colors.ActiveLinkColor = Services.prefs.getCharPref("browser.active_color");
   colors.VisitedLinkColor = Services.prefs.getCharPref("browser.visited_color");
 
   return colors;
 }
 
-/************* URL handling ***************/
+/** *********** URL handling ***************/
 
-function TextIsURI(selectedText)
-{
+function TextIsURI(selectedText) {
   return selectedText && /^http:\/\/|^https:\/\/|^file:\/\/|^ftp:\/\/|^about:|^mailto:|^news:|^snews:|^telnet:|^ldap:|^ldaps:|^gopher:|^finger:|^javascript:/i.test(selectedText);
 }
 
-function IsUrlAboutBlank(urlString)
-{
+function IsUrlAboutBlank(urlString) {
   return (urlString == "about:blank");
 }
 
-function MakeRelativeUrl(url)
-{
+function MakeRelativeUrl(url) {
   let inputUrl = url.trim();
   if (!inputUrl)
     return inputUrl;
 
   // Get the filespec relative to current document's location
   // NOTE: Can't do this if file isn't saved yet!
   var docUrl = GetDocumentBaseUrl();
   var docScheme = GetScheme(docUrl);
@@ -534,83 +475,72 @@ function MakeRelativeUrl(url)
   var nextDocSlash = 0;
   var done = false;
 
   // Remove all matching subdirs common to both doc and input urls
   do {
     nextDocSlash = docPath.indexOf("\/");
     var nextUrlSlash = urlPath.indexOf("\/");
 
-    if (nextUrlSlash == -1)
-    {
+    if (nextUrlSlash == -1) {
       // We're done matching and all dirs in url
       // what's left is the filename
       done = true;
 
       // Remove filename for named anchors in the same file
-      if (nextDocSlash == -1 && docFilename)
-      {
+      if (nextDocSlash == -1 && docFilename) {
         var anchorIndex = urlPath.indexOf("#");
-        if (anchorIndex > 0)
-        {
+        if (anchorIndex > 0) {
           var urlFilename = doCaseInsensitive ? urlPath.toLowerCase() : urlPath;
 
           if (urlFilename.startsWith(docFilename))
             urlPath = urlPath.slice(anchorIndex);
         }
       }
-    }
-    else if (nextDocSlash >= 0)
-    {
+    } else if (nextDocSlash >= 0) {
       // Test for matching subdir
       var docDir = docPath.slice(0, nextDocSlash);
       var urlDir = urlPath.slice(0, nextUrlSlash);
       if (doCaseInsensitive)
         urlDir = urlDir.toLowerCase();
 
-      if (urlDir == docDir)
-      {
+      if (urlDir == docDir) {
         // Remove matching dir+"/" from each path
         // and continue to next dir.
-        docPath = docPath.slice(nextDocSlash+1);
-        urlPath = urlPath.slice(nextUrlSlash+1);
-      }
-      else
-      {
+        docPath = docPath.slice(nextDocSlash + 1);
+        urlPath = urlPath.slice(nextUrlSlash + 1);
+      } else {
         // No match, we're done.
         done = true;
 
         // Be sure we are on the same local drive or volume
         //   (the first "dir" in the path) because we can't
         //   relativize to different drives/volumes.
         // UNIX doesn't have volumes, so we must not do this else
         // the first directory will be misinterpreted as a volume name.
         if (firstDirTest && docScheme == "file" &&
             AppConstants.platform != "unix")
           return inputUrl;
       }
-    }
-    else  // No more doc dirs left, we're done
+    } else  // No more doc dirs left, we're done
       done = true;
 
     firstDirTest = false;
   }
   while (!done);
 
   // Add "../" for each dir left in docPath
-  while (nextDocSlash > 0)
-  {
+  while (nextDocSlash > 0) {
     urlPath = "../" + urlPath;
-    nextDocSlash = docPath.indexOf("\/", nextDocSlash+1);
+    nextDocSlash = docPath.indexOf("\/", nextDocSlash + 1);
   }
   return urlPath;
 }
 
-function MakeAbsoluteUrl(url)
-{
+function MakeAbsoluteUrl(url) {
   let resultUrl = TrimString(url);
   if (!resultUrl)
     return resultUrl;
 
   // Check if URL is already absolute, i.e., it has a scheme
   let urlScheme = GetScheme(resultUrl);
 
   if (urlScheme)
@@ -626,260 +556,235 @@ function MakeAbsoluteUrl(url)
   // Make a URI object to use its "resolve" method
   let absoluteUrl = resultUrl;
   let docUri = Services.io.newURI(docUrl, GetCurrentEditor().documentCharacterSet);
 
   try {
     absoluteUrl = docUri.resolve(resultUrl);
     // This is deprecated and buggy!
     // If used, we must make it a path for the parent directory (remove filename)
-    //absoluteUrl = IOService.resolveRelativePath(resultUrl, docUrl);
+    // absoluteUrl = IOService.resolveRelativePath(resultUrl, docUrl);
   } catch (e) {}
 
   return absoluteUrl;
 }
 
 // Get the HREF of the page's <base> tag or the document location
 // returns empty string if no base href and document hasn't been saved yet
-function GetDocumentBaseUrl()
-{
+function GetDocumentBaseUrl() {
   try {
     var docUrl;
 
     // if document supplies a <base> tag, use that URL instead
     let base = GetCurrentEditor().document.querySelector("base");
     if (base)
       docUrl = base.getAttribute("href");
     if (!docUrl)
       docUrl = GetDocumentUrl();
 
     if (!IsUrlAboutBlank(docUrl))
       return docUrl;
   } catch (e) {}
   return "";
 }
 
-function GetDocumentUrl()
-{
+function GetDocumentUrl() {
   try {
-    return GetCurrentEditor().document.URL;;
-  }
-  catch (e) {}
+    return GetCurrentEditor().document.URL;
+  } catch (e) {}
   return "";
 }
 
 // Extract the scheme (e.g., 'file', 'http') from a URL string
-function GetScheme(urlspec)
-{
+function GetScheme(urlspec) {
   var resultUrl = TrimString(urlspec);
   // Unsaved document URL has no acceptable scheme yet
   if (!resultUrl || IsUrlAboutBlank(resultUrl))
     return "";
 
   var scheme = "";
   try {
     // This fails if there's no scheme
     scheme = Services.io.extractScheme(resultUrl);
   } catch (e) {}
 
   return scheme ? scheme.toLowerCase() : "";
 }
 
-function GetHost(urlspec)
-{
+function GetHost(urlspec) {
   if (!urlspec)
     return "";
 
   var host = "";
   try {
     host = Services.io.newURI(urlspec).host;
    } catch (e) {}
 
   return host;
 }
 
-function GetUsername(urlspec)
-{
+function GetUsername(urlspec) {
   if (!urlspec)
     return "";
 
   var username = "";
   try {
     username = Services.io.newURI(urlspec).username;
   } catch (e) {}
 
   return username;
 }
 
-function GetFilename(urlspec)
-{
+function GetFilename(urlspec) {
   if (!urlspec || IsUrlAboutBlank(urlspec))
     return "";
 
   var filename;
 
   try {
     let uri = Services.io.newURI(urlspec);
-    if (uri)
-    {
+    if (uri) {
       let url = uri.QueryInterface(Ci.nsIURL);
       if (url)
         filename = url.fileName;
     }
   } catch (e) {}
 
   return filename ? filename : "";
 }
 
 // Return the url without username and password
 // Optional output objects return extracted username and password strings
 // This uses just string routines via nsIIOServices
-function StripUsernamePassword(urlspec, usernameObj, passwordObj)
-{
+function StripUsernamePassword(urlspec, usernameObj, passwordObj) {
   urlspec = TrimString(urlspec);
   if (!urlspec || IsUrlAboutBlank(urlspec))
     return urlspec;
 
   if (usernameObj)
     usernameObj.value = "";
   if (passwordObj)
     passwordObj.value = "";
 
   // "@" must exist else we will never detect username or password
   var atIndex = urlspec.indexOf("@");
-  if (atIndex > 0)
-  {
+  if (atIndex > 0) {
     try {
       let uri = Services.io.newURI(urlspec);
       let username = uri.username;
       let password = uri.password;
 
       if (usernameObj && username)
         usernameObj.value = username;
       if (passwordObj && password)
         passwordObj.value = password;
-      if (username)
-      {
+      if (username) {
         let usernameStart = urlspec.indexOf(username);
         if (usernameStart != -1)
-          return urlspec.slice(0, usernameStart) + urlspec.slice(atIndex+1);
+          return urlspec.slice(0, usernameStart) + urlspec.slice(atIndex + 1);
       }
     } catch (e) {}
   }
   return urlspec;
 }
 
-function StripPassword(urlspec, passwordObj)
-{
+function StripPassword(urlspec, passwordObj) {
   urlspec = TrimString(urlspec);
   if (!urlspec || IsUrlAboutBlank(urlspec))
     return urlspec;
 
   if (passwordObj)
     passwordObj.value = "";
 
   // "@" must exist else we will never detect password
   var atIndex = urlspec.indexOf("@");
-  if (atIndex > 0)
-  {
+  if (atIndex > 0) {
     try {
       let password = Services.io.newURI(urlspec).password;
 
       if (passwordObj && password)
         passwordObj.value = password;
-      if (password)
-      {
+      if (password) {
         // Find last ":" before "@"
         let colon = urlspec.lastIndexOf(":", atIndex);
-        if (colon != -1)
-        {
+        if (colon != -1) {
           // Include the "@"
           return urlspec.slice(0, colon) + urlspec.slice(atIndex);
         }
       }
     } catch (e) {}
   }
   return urlspec;
 }
 
 // Version to use when you have an nsIURI object
-function StripUsernamePasswordFromURI(uri)
-{
+function StripUsernamePasswordFromURI(uri) {
   var urlspec = "";
-  if (uri)
-  {
+  if (uri) {
     try {
       urlspec = uri.spec;
       var userPass = uri.userPass;
-      if (userPass)
-      {
+      if (userPass) {
         start = urlspec.indexOf(userPass);
-        urlspec = urlspec.slice(0, start) + urlspec.slice(start+userPass.length+1);
+        urlspec = urlspec.slice(0, start) + urlspec.slice(start + userPass.length + 1);
       }
     } catch (e) {}
   }
   return urlspec;
 }
 
-function InsertUsernameIntoUrl(urlspec, username)
-{
+function InsertUsernameIntoUrl(urlspec, username) {
   if (!urlspec || !username)
     return urlspec;
 
   try {
     let URI = Services.io.newURI(urlspec, GetCurrentEditor().documentCharacterSet);
     URI.username = username;
     return URI.spec;
   } catch (e) {}
 
   return urlspec;
 }
 
-function ConvertRGBColorIntoHEXColor(color)
-{
-  if ( /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.test(color) ) {
+function ConvertRGBColorIntoHEXColor(color) {
+  if (/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.test(color)) {
     var r = Number(RegExp.$1).toString(16);
-    if (r.length == 1) r = "0"+r;
+    if (r.length == 1) r = "0" + r;
     var g = Number(RegExp.$2).toString(16);
-    if (g.length == 1) g = "0"+g;
+    if (g.length == 1) g = "0" + g;
     var b = Number(RegExp.$3).toString(16);
-    if (b.length == 1) b = "0"+b;
-    return "#"+r+g+b;
+    if (b.length == 1) b = "0" + b;
+    return "#" + r + g + b;
   }
-  else
-  {
+
     return color;
-  }
 }
 
-/************* CSS ***************/
+/** *********** CSS ***************/
 
-function GetHTMLOrCSSStyleValue(element, attrName, cssPropertyName)
-{
+function GetHTMLOrCSSStyleValue(element, attrName, cssPropertyName) {
   var value;
   if (Services.prefs.getBoolPref("editor.use_css") && IsHTMLEditor())
     value = element.style.getPropertyValue(cssPropertyName);
 
   if (!value)
     value = element.getAttribute(attrName);
 
   if (!value)
     return "";
 
   return value;
 }
 
-/************* Miscellaneous ***************/
+/** *********** Miscellaneous ***************/
 // Clone simple JS objects
-function Clone(obj)
-{
+function Clone(obj) {
   var clone = {};
-  for (var i in obj)
-  {
-    if (typeof obj[i] == 'object')
+  for (var i in obj) {
+    if (typeof obj[i] == "object")
       clone[i] = Clone(obj[i]);
     else
       clone[i] = obj[i];
   }
   return clone;
 }
 
 /**
--- a/editor/ui/dialogs/content/EdAEAttributes.js
+++ b/editor/ui/dialogs/content/EdAEAttributes.js
@@ -10,17 +10,17 @@ var gJSAttr = {};
 
 
 // Core HTML attribute values //
 // This is appended to Name menulist when "_core" is attribute name
 var gCoreHTMLAttr =
 [
   "^id",
   "class",
-  "title"
+  "title",
 ];
 
 // Core event attribute values //
 // This is appended to all JS menulists
 //   except those elements having "noJSEvents"
 //   as a value in their gJSAttr array.
 var gCoreJSEvents =
 [
@@ -29,17 +29,17 @@ var gCoreJSEvents =
   "onmousedown",
   "onmouseup",
   "onmouseover",
   "onmousemove",
   "onmouseout",
   "-",
   "onkeypress",
   "onkeydown",
-  "onkeyup"
+  "onkeyup",
 ];
 
 // Following are commonly-used strings
 
 // Also accept: sRGB: #RRGGBB //
 var gHTMLColors =
 [
   "Aqua",
@@ -52,57 +52,57 @@ var gHTMLColors =
   "Maroon",
   "Navy",
   "Olive",
   "Purple",
   "Red",
   "Silver",
   "Teal",
   "White",
-  "Yellow"
+  "Yellow",
 ];
 
 var gHAlign =
 [
   "left",
   "center",
-  "right"
+  "right",
 ];
 
 var gHAlignJustify =
 [
   "left",
   "center",
   "right",
-  "justify"
+  "justify",
 ];
 
 var gHAlignTableContent =
 [
   "left",
   "center",
   "right",
   "justify",
-  "char"
+  "char",
 ];
 
 var gVAlignTable =
 [
   "top",
   "middle",
   "bottom",
-  "baseline"
+  "baseline",
 ];
 
 var gTarget =
 [
   "_blank",
   "_self",
   "_parent",
-  "_top"
+  "_top",
 ];
 
 // ================ HTML Attributes ================ //
 /* For each element, there is an array of attributes,
    whose name is the element name,
    used to fill the "Attribute Name" menulist.
    For each of those attributes, if they have a specific
    set of values, those are listed in an array named:
@@ -122,17 +122,17 @@ var gTarget =
    Most elements have the "dir" attribute,
    so we use this value array
    for all elements instead of specifying
    separately for each element
 */
 gHTMLAttr.all_dir =
 [
   "ltr",
-  "rtl"
+  "rtl",
 ];
 
 
 gHTMLAttr.a =
 [
   "charset",
   "type",
   "name",
@@ -144,17 +144,17 @@ gHTMLAttr.a =
   "!accesskey",
   "shape",   // with imagemap //
   "coords",  // with imagemap //
   "#tabindex",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.a_target = gTarget;
 
 gHTMLAttr.a_rel =
 [
   "alternate",
   "stylesheet",
@@ -165,17 +165,17 @@ gHTMLAttr.a_rel =
   "index",
   "glossary",
   "copyright",
   "chapter",
   "section",
   "subsection",
   "appendix",
   "help",
-  "bookmark"
+  "bookmark",
 ];
 
 gHTMLAttr.a_rev =
 [
   "alternate",
   "stylesheet",
   "start",
   "next",
@@ -184,49 +184,49 @@ gHTMLAttr.a_rev =
   "index",
   "glossary",
   "copyright",
   "chapter",
   "section",
   "subsection",
   "appendix",
   "help",
-  "bookmark"
+  "bookmark",
 ];
 
 gHTMLAttr.a_shape =
 [
   "rect",
   "circle",
   "poly",
-  "default"
+  "default",
 ];
 
 gHTMLAttr.abbr =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.acronym =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.address =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 // this is deprecated //
 gHTMLAttr.applet =
 [
   "codebase",
   "archive",
   "code",
@@ -234,397 +234,397 @@ gHTMLAttr.applet =
   "alt",
   "name",
   "%$width",
   "%$height",
   "align",
   "#hspace",
   "#vspace",
   "-",
-  "_core"
+  "_core",
 ];
 
 gHTMLAttr.applet_align =
 [
   "top",
   "middle",
   "bottom",
   "left",
-  "right"
+  "right",
 ];
 
 gHTMLAttr.area =
 [
   "shape",
   "coords",
   "href",
   "nohref",
   "target",
   "$alt",
   "#tabindex",
   "!accesskey",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.area_target = gTarget;
 
 gHTMLAttr.area_shape =
 [
   "rect",
   "circle",
   "poly",
-  "default"
+  "default",
 ];
 
 gHTMLAttr.area_nohref =
 [
-  "nohref"
+  "nohref",
 ];
 
 gHTMLAttr.b =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.base =
 [
   "href",
-  "target"
+  "target",
 ];
 
 gHTMLAttr.base_target = gTarget;
 
 // this is deprecated //
 gHTMLAttr.basefont =
 [
   "^id",
   "$size",
   "color",
-  "face"
+  "face",
 ];
 
 gHTMLAttr.basefont_color = gHTMLColors;
 
 gHTMLAttr.bdo =
 [
   "_core",
   "-",
   "^lang",
-  "$dir"
+  "$dir",
 ];
 
 gHTMLAttr.bdo_dir =
 [
   "ltr",
-  "rtl"
+  "rtl",
 ];
 
 gHTMLAttr.big =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.blockquote =
 [
   "cite",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.body =
 [
   "background",
   "bgcolor",
   "text",
   "link",
   "vlink",
   "alink",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.body_bgcolor = gHTMLColors;
 
 gHTMLAttr.body_text = gHTMLColors;
 
 gHTMLAttr.body_link = gHTMLColors;
 
 gHTMLAttr.body_vlink = gHTMLColors;
 
 gHTMLAttr.body_alink = gHTMLColors;
 
 gHTMLAttr.br =
 [
   "clear",
   "-",
-  "_core"
+  "_core",
 ];
 
 gHTMLAttr.br_clear =
 [
   "none",
   "left",
   "all",
-  "right"
+  "right",
 ];
 
 gHTMLAttr.button =
 [
   "name",
   "value",
   "$type",
   "disabled",
   "#tabindex",
   "!accesskey",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.button_type =
 [
   "submit",
   "button",
-  "reset"
+  "reset",
 ];
 
 gHTMLAttr.button_disabled =
 [
-  "disabled"
+  "disabled",
 ];
 
 gHTMLAttr.caption =
 [
   "align",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.caption_align =
 [
   "top",
   "bottom",
   "left",
-  "right"
+  "right",
 ];
 
 
 // this is deprecated //
 gHTMLAttr.center =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.cite =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.code =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.col =
 [
   "#$span",
   "%width",
   "align",
   "!char",
   "#charoff",
   "valign",
   "char",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.col_span =
 [
-  "1"  // default
+  "1",  // default
 ];
 
 gHTMLAttr.col_align = gHAlignTableContent;
 
 gHTMLAttr.col_valign =
 [
   "top",
   "middle",
   "bottom",
-  "baseline"
+  "baseline",
 ];
 
 
 gHTMLAttr.colgroup =
 [
   "#$span",
   "%width",
   "align",
   "!char",
   "#charoff",
   "valign",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.colgroup_span =
 [
-  "1" // default
+  "1", // default
 ];
 
 gHTMLAttr.colgroup_align = gHAlignTableContent;
 
 gHTMLAttr.colgroup_valign =
 [
   "top",
   "middle",
   "bottom",
-  "baseline"
+  "baseline",
 ];
 
 gHTMLAttr.dd =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.del =
 [
   "cite",
   "datetime",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.dfn =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 // this is deprecated //
 gHTMLAttr.dir =
 [
   "compact",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.dir_compact =
 [
-  "compact"
+  "compact",
 ];
 
 gHTMLAttr.div =
 [
   "align",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.div_align = gHAlignJustify;
 
 gHTMLAttr.dl =
 [
   "compact",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.dl_compact =
 [
-  "compact"
+  "compact",
 ];
 
 
 gHTMLAttr.dt =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.em =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.fieldset =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 // this is deprecated //
 gHTMLAttr.font =
 [
   "+size",
   "color",
   "face",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.font_color = gHTMLColors;
 
 gHTMLAttr.form =
 [
   "$action",
   "$method",
@@ -632,225 +632,225 @@ gHTMLAttr.form =
   "accept",
   "name",
   "accept-charset",
   "target",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.form_method =
 [
   "get",
-  "post"
+  "post",
 ];
 
 gHTMLAttr.form_enctype =
 [
-  "application/x-www-form-urlencoded"
+  "application/x-www-form-urlencoded",
 ];
 
 gHTMLAttr.form_target = gTarget;
 
 gHTMLAttr.frame =
 [
   "longdesc",
   "name",
   "src",
   "#frameborder",
   "#marginwidth",
   "#marginheight",
   "noresize",
-  "$scrolling"
+  "$scrolling",
 ];
 
 gHTMLAttr.frame_frameborder =
 [
   "1",
-  "0"
+  "0",
 ];
 
 gHTMLAttr.frame_noresize =
 [
-  "noresize"
+  "noresize",
 ];
 
 gHTMLAttr.frame_scrolling =
 [
   "auto",
   "yes",
-  "no"
+  "no",
 ];
 
 
 gHTMLAttr.frameset =
 [
   "rows",
   "cols",
   "-",
-  "_core"
+  "_core",
 ];
 
 gHTMLAttr.h1 =
 [
   "align",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.h1_align = gHAlignJustify;
 
 gHTMLAttr.h2 =
 [
   "align",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.h2_align = gHAlignJustify;
 
 gHTMLAttr.h3 =
 [
   "align",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.h3_align =  gHAlignJustify;
 
 gHTMLAttr.h4 =
 [
   "align",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.h4_align = gHAlignJustify;
 
 
 gHTMLAttr.h5 =
 [
   "align",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.h5_align = gHAlignJustify;
 
 gHTMLAttr.h6 =
 [
   "align",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.h6_align = gHAlignJustify;
 
 gHTMLAttr.head =
 [
   "profile",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.hr =
 [
   "align",
   "noshade",
   "#size",
   "%width",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.hr_align = gHAlign;
 
 gHTMLAttr.hr_noshade =
 [
-  "noshade"
+  "noshade",
 ];
 
 
 gHTMLAttr.html =
 [
   "version",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.i =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.iframe =
 [
   "longdesc",
   "name",
   "src",
   "$frameborder",
   "marginwidth",
   "marginheight",
   "$scrolling",
   "align",
   "%height",
   "%width",
   "-",
-  "_core"
+  "_core",
 ];
 
 gHTMLAttr.iframe_frameborder =
 [
   "1",
-  "0"
+  "0",
 ];
 
 gHTMLAttr.iframe_scrolling =
 [
   "auto",
   "yes",
-  "no"
+  "no",
 ];
 
 gHTMLAttr.iframe_align =
 [
   "top",
   "middle",
   "bottom",
   "left",
-  "right"
+  "right",
 ];
 
 gHTMLAttr.img =
 [
   "$src",
   "$alt",
   "longdesc",
   "name",
@@ -861,31 +861,31 @@ gHTMLAttr.img =
   "align",
   "#border",
   "#hspace",
   "#vspace",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.img_ismap =
 [
-  "ismap"
+  "ismap",
 ];
 
 gHTMLAttr.img_align =
 [
   "top",
   "middle",
   "bottom",
   "left",
-  "right"
+  "right",
 ];
 
 gHTMLAttr.input =
 [
   "$type",
   "name",
   "value",
   "checked",
@@ -900,162 +900,162 @@ gHTMLAttr.input =
   "#tabindex",
   "!accesskey",
   "accept",
   "align",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.input_type =
 [
   "text",
   "password",
   "checkbox",
   "radio",
   "submit",
   "reset",
   "file",
   "hidden",
   "image",
-  "button"
+  "button",
 ];
 
 gHTMLAttr.input_checked =
 [
-  "checked"
+  "checked",
 ];
 
 gHTMLAttr.input_disabled =
 [
-  "disabled"
+  "disabled",
 ];
 
 gHTMLAttr.input_readonly =
 [
-  "readonly"
+  "readonly",
 ];
 
 
 gHTMLAttr.input_ismap =
 [
-  "ismap"
+  "ismap",
 ];
 
 
 gHTMLAttr.input_align =
 [
   "top",
   "middle",
   "bottom",
   "left",
-  "right"
+  "right",
 ];
 
 gHTMLAttr.ins =
 [
   "cite",
   "datetime",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.isindex =
 [
   "prompt",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.kbd =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.label =
 [
   "for",
   "!accesskey",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.legend =
 [
   "!accesskey",
   "align",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.legend_align =
 [
   "top",
   "bottom",
   "left",
-  "right"
+  "right",
 ];
 
 gHTMLAttr.li =
 [
   "type",
   "#value",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.li_type =
 [
   "disc",
   "square",
   "circle",
   "-",
   "1",
   "a",
   "A",
   "i",
-  "I"
+  "I",
 ];
 
 gHTMLAttr.link =
 [
   "charset",
   "href",
   "^hreflang",
   "type",
   "rel",
   "rev",
   "media",
   "target",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.link_target = gTarget;
 
 gHTMLAttr.link_rel =
 [
   "alternate",
   "stylesheet",
@@ -1066,17 +1066,17 @@ gHTMLAttr.link_rel =
   "index",
   "glossary",
   "copyright",
   "chapter",
   "section",
   "subsection",
   "appendix",
   "help",
-  "bookmark"
+  "bookmark",
 ];
 
 gHTMLAttr.link_rev =
 [
   "alternate",
   "stylesheet",
   "start",
   "next",
@@ -1085,69 +1085,69 @@ gHTMLAttr.link_rev =
   "index",
   "glossary",
   "copyright",
   "chapter",
   "section",
   "subsection",
   "appendix",
   "help",
-  "bookmark"
+  "bookmark",
 ];
 
 gHTMLAttr.map =
 [
   "$name",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.menu =
 [
   "compact",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.menu_compact =
 [
-  "compact"
+  "compact",
 ];
 
 gHTMLAttr.meta =
 [
   "http-equiv",
   "name",
   "$content",
   "scheme",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.noframes =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.noscript =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.object =
 [
   "declare",
   "classid",
   "codebase",
   "data",
@@ -1163,261 +1163,261 @@ gHTMLAttr.object =
   "align",
   "#border",
   "#hspace",
   "#vspace",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.object_declare =
 [
-  "declare"
+  "declare",
 ];
 
 gHTMLAttr.object_align =
 [
   "top",
   "middle",
   "bottom",
   "left",
-  "right"
+  "right",
 ];
 
 gHTMLAttr.ol =
 [
   "type",
   "compact",
   "#start",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.ol_type =
 [
   "1",
   "a",
   "A",
   "i",
-  "I"
+  "I",
 ];
 
 gHTMLAttr.ol_compact =
 [
-  "compact"
+  "compact",
 ];
 
 
 gHTMLAttr.optgroup =
 [
   "disabled",
   "$label",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.optgroup_disabled =
 [
-  "disabled"
+  "disabled",
 ];
 
 
 gHTMLAttr.option =
 [
   "selected",
   "disabled",
   "label",
   "value",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.option_selected =
 [
-  "selected"
+  "selected",
 ];
 
 gHTMLAttr.option_disabled =
 [
-  "disabled"
+  "disabled",
 ];
 
 
 gHTMLAttr.p =
 [
   "align",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.p_align = gHAlignJustify;
 
 gHTMLAttr.param =
 [
   "^id",
   "$name",
   "value",
   "$valuetype",
-  "type"
+  "type",
 ];
 
 gHTMLAttr.param_valuetype =
 [
   "data",
   "ref",
-  "object"
+  "object",
 ];
 
 
 gHTMLAttr.pre =
 [
   "%width",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.q =
 [
   "cite",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.s =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.samp =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.script =
 [
   "charset",
   "$type",
   "language",
   "src",
-  "defer"
+  "defer",
 ];
 
 gHTMLAttr.script_defer =
 [
-  "defer"
+  "defer",
 ];
 
 
 gHTMLAttr.select =
 [
   "name",
   "#size",
   "multiple",
   "disabled",
   "#tabindex",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.select_multiple =
 [
-  "multiple"
+  "multiple",
 ];
 
 gHTMLAttr.select_disabled =
 [
-  "disabled"
+  "disabled",
 ];
 
 gHTMLAttr.small =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.span =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.strike =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.strong =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.style =
 [
   "$type",
   "media",
   "title",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.sub =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.sup =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.table =
 [
   "summary",
   "%width",
   "#border",
   "frame",
@@ -1425,39 +1425,39 @@ gHTMLAttr.table =
   "#cellspacing",
   "#cellpadding",
   "align",
   "bgcolor",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.table_frame =
 [
   "void",
   "above",
   "below",
   "hsides",
   "lhs",
   "rhs",
   "vsides",
   "box",
-  "border"
+  "border",
 ];
 
 gHTMLAttr.table_rules =
 [
   "none",
   "groups",
   "rows",
   "cols",
-  "all"
+  "all",
 ];
 
 // Note; This is alignment of the table,
 //  not table contents, like all other table child elements
 gHTMLAttr.table_align = gHAlign;
 
 gHTMLAttr.table_bgcolor = gHTMLColors;
 
@@ -1466,17 +1466,17 @@ gHTMLAttr.tbody =
   "align",
   "!char",
   "#charoff",
   "valign",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.tbody_align = gHAlignTableContent;
 
 gHTMLAttr.tbody_valign = gVAlignTable;
 
 gHTMLAttr.td =
 [
@@ -1493,44 +1493,44 @@ gHTMLAttr.td =
   "nowrap",
   "bgcolor",
   "%width",
   "%height",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.td_scope =
 [
   "row",
   "col",
   "rowgroup",
-  "colgroup"
+  "colgroup",
 ];
 
 gHTMLAttr.td_rowspan =
 [
-  "1" // default
+  "1", // default
 ];
 
 gHTMLAttr.td_colspan =
 [
-  "1" // default
+  "1", // default
 ];
 
 gHTMLAttr.td_align = gHAlignTableContent;
 
 gHTMLAttr.td_valign = gVAlignTable;
 
 gHTMLAttr.td_nowrap =
 [
-  "nowrap"
+  "nowrap",
 ];
 
 gHTMLAttr.td_bgcolor = gHTMLColors;
 
 gHTMLAttr.textarea =
 [
   "name",
   "$#rows",
@@ -1538,41 +1538,41 @@ gHTMLAttr.textarea =
   "disabled",
   "readonly",
   "#tabindex",
   "!accesskey",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.textarea_disabled =
 [
-  "disabled"
+  "disabled",
 ];
 
 gHTMLAttr.textarea_readonly =
 [
-  "readonly"
+  "readonly",
 ];
 
 
 gHTMLAttr.tfoot =
 [
   "align",
   "!char",
   "#charoff",
   "valign",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.tfoot_align = gHAlignTableContent;
 
 gHTMLAttr.tfoot_valign = gVAlignTable;
 
 gHTMLAttr.th =
 [
@@ -1589,223 +1589,223 @@ gHTMLAttr.th =
   "nowrap",
   "bgcolor",
   "%width",
   "%height",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.th_scope =
 [
   "row",
   "col",
   "rowgroup",
-  "colgroup"
+  "colgroup",
 ];
 
 gHTMLAttr.th_rowspan =
 [
-  "1" // default
+  "1", // default
 ];
 
 gHTMLAttr.th_colspan =
 [
-  "1" // default
+  "1", // default
 ];
 
 gHTMLAttr.th_align = gHAlignTableContent;
 
 gHTMLAttr.th_valign = gVAlignTable;
 
 gHTMLAttr.th_nowrap =
 [
-  "nowrap"
+  "nowrap",
 ];
 
 gHTMLAttr.th_bgcolor = gHTMLColors;
 
 gHTMLAttr.thead =
 [
   "align",
   "!char",
   "#charoff",
   "valign",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.thead_align = gHAlignTableContent;
 
 gHTMLAttr.thead_valign = gVAlignTable;
 
 gHTMLAttr.title =
 [
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.tr =
 [
   "align",
   "!char",
   "#charoff",
   "valign",
   "bgcolor",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.tr_align = gHAlignTableContent;
 
 gHTMLAttr.tr_valign = gVAlignTable;
 
 gHTMLAttr.tr_bgcolor = gHTMLColors;
 
 gHTMLAttr.tt =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.u =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 gHTMLAttr.ul =
 [
   "type",
   "compact",
   "-",
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 gHTMLAttr.ul_type =
 [
   "disc",
   "square",
-  "circle"
+  "circle",
 ];
 
 gHTMLAttr.ul_compact =
 [
-  "compact"
+  "compact",
 ];
 
 
 // Prefix with "_" since this is reserved (it's stripped out)
 gHTMLAttr._var =
 [
   "_core",
   "-",
   "^lang",
-  "dir"
+  "dir",
 ];
 
 // ================ JS Attributes ================ //
 // These are element specific even handlers.
 /* Most all elements use gCoreJSEvents, so those
    are assumed except for those listed here with "noEvents"
 */
 
 gJSAttr.a =
 [
   "onfocus",
-  "onblur"
+  "onblur",
 ];
 
 gJSAttr.area =
 [
   "onfocus",
-  "onblur"
+  "onblur",
 ];
 
 gJSAttr.body =
 [
   "onload",
-  "onupload"
+  "onupload",
 ];
 
 gJSAttr.button =
 [
   "onfocus",
-  "onblur"
+  "onblur",
 ];
 
 gJSAttr.form =
 [
   "onsubmit",
-  "onreset"
+  "onreset",
 ];
 
 gJSAttr.frameset =
 [
   "onload",
-  "onunload"
+  "onunload",
 ];
 
 gJSAttr.input =
 [
   "onfocus",
   "onblur",
   "onselect",
-  "onchange"
+  "onchange",
 ];
 
 gJSAttr.label =
 [
   "onfocus",
-  "onblur"
+  "onblur",
 ];
 
 gJSAttr.select =
 [
   "onfocus",
   "onblur",
-  "onchange"
+  "onchange",
 ];
 
 gJSAttr.textarea =
 [
   "onfocus",
   "onblur",
   "onselect",
-  "onchange"
+  "onchange",
 ];
 
 // Elements that don't have JSEvents:
 gJSAttr.font =
 [
-  "noJSEvents"
+  "noJSEvents",
 ];
 
 gJSAttr.applet =
 [
-  "noJSEvents"
+  "noJSEvents",
 ];
 
 gJSAttr.isindex =
 [
-  "noJSEvents"
+  "noJSEvents",
 ];
 
 gJSAttr.iframe =
 [
-  "noJSEvents"
+  "noJSEvents",
 ];
 
--- a/editor/ui/dialogs/content/EdAECSSAttributes.js
+++ b/editor/ui/dialogs/content/EdAECSSAttributes.js
@@ -1,144 +1,126 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // build attribute list in tree form from element attributes
-function BuildCSSAttributeTable()
-{
+function BuildCSSAttributeTable() {
   var style = gElement.style;
-  if (style == undefined)
-  {
+  if (style == undefined) {
     dump("Inline styles undefined\n");
     return;
   }
 
   var declLength = style.length;
 
-  if (declLength == undefined || declLength == 0)
-  {
+  if (declLength == undefined || declLength == 0) {
     if (declLength == undefined) {
       dump("Failed to query the number of inline style declarations\n");
     }
 
     return;
   }
 
-  if (declLength > 0)
-  {
-    for (var i = 0; i < declLength; ++i)
-    {
+  if (declLength > 0) {
+    for (var i = 0; i < declLength; ++i) {
       var name = style.item(i);
       var value = style.getPropertyValue(name);
-      AddTreeItem( name, value, "CSSAList", CSSAttrs );
+      AddTreeItem(name, value, "CSSAList", CSSAttrs);
     }
   }
 
   ClearCSSInputWidgets();
 }
 
-function onChangeCSSAttribute()
-{
+function onChangeCSSAttribute() {
   var name = TrimString(gDialog.AddCSSAttributeNameInput.value);
-  if ( !name )
+  if (!name)
     return;
 
   var value = TrimString(gDialog.AddCSSAttributeValueInput.value);
 
   // First try to update existing attribute
   // If not found, add new attribute
-  if ( !UpdateExistingAttribute( name, value, "CSSAList" ) && value)
-    AddTreeItem( name, value, "CSSAList", CSSAttrs );
+  if (!UpdateExistingAttribute(name, value, "CSSAList") && value)
+    AddTreeItem(name, value, "CSSAList", CSSAttrs);
 }
 
-function ClearCSSInputWidgets()
-{
+function ClearCSSInputWidgets() {
   gDialog.AddCSSAttributeTree.view.selection.clearSelection();
-  gDialog.AddCSSAttributeNameInput.value ="";
+  gDialog.AddCSSAttributeNameInput.value = "";
   gDialog.AddCSSAttributeValueInput.value = "";
   SetTextboxFocus(gDialog.AddCSSAttributeNameInput);
 }
 
-function onSelectCSSTreeItem()
-{
+function onSelectCSSTreeItem() {
   if (!gDoOnSelectTree)
     return;
 
   var tree = gDialog.AddCSSAttributeTree;
-  if (tree && tree.view.selection.count)
-  {
+  if (tree && tree.view.selection.count) {
     gDialog.AddCSSAttributeNameInput.value = GetTreeItemAttributeStr(getSelectedItem(tree));
     gDialog.AddCSSAttributeValueInput.value = GetTreeItemValueStr(getSelectedItem(tree));
   }
 }
 
-function onInputCSSAttributeName()
-{
+function onInputCSSAttributeName() {
   var attName = TrimString(gDialog.AddCSSAttributeNameInput.value).toLowerCase();
   var newValue = "";
 
   var existingValue = GetAndSelectExistingAttributeValue(attName, "CSSAList");
   if (existingValue)
     newValue = existingValue;
 
   gDialog.AddCSSAttributeValueInput.value = newValue;
 }
 
-function editCSSAttributeValue(targetCell)
-{
+function editCSSAttributeValue(targetCell) {
   if (IsNotTreeHeader(targetCell))
     gDialog.AddCSSAttributeValueInput.inputField.select();
 }
 
-function UpdateCSSAttributes()
-{
+function UpdateCSSAttributes() {
   var CSSAList = document.getElementById("CSSAList");
   var styleString = "";
-  for(var i = 0; i < CSSAList.childNodes.length; i++)
-  {
+  for (var i = 0; i < CSSAList.childNodes.length; i++) {
     var item = CSSAList.childNodes[i];
     var name = GetTreeItemAttributeStr(item);
     var value = GetTreeItemValueStr(item);
     // this code allows users to be sloppy in typing in values, and enter
     // things like "foo: " and "bar;". This will trim off everything after the
     // respective character.
     if (name.includes(":"))
       name = name.substring(0, name.lastIndexOf(":"));
     if (value.includes(";"))
       value = value.substring(0, value.lastIndexOf(";"));
     if (i == (CSSAList.childNodes.length - 1))
       styleString += name + ": " + value + ";";   // last property
     else
       styleString += name + ": " + value + "; ";
   }
-  if (styleString)
-  {
+  if (styleString) {
     // Use editor transactions if modifying the element directly in the document
     doRemoveAttribute("style");
     doSetAttribute("style", styleString);  // NOTE BUG 18894!!!
-  }
-  else if (gElement.getAttribute("style"))
+  } else if (gElement.getAttribute("style"))
     doRemoveAttribute("style");
 }
 
-function RemoveCSSAttribute()
-{
+function RemoveCSSAttribute() {
   // We only allow 1 selected item
-  if (gDialog.AddCSSAttributeTree.view.selection.count)
-  {
+  if (gDialog.AddCSSAttributeTree.view.selection.count) {
     // Remove the item from the tree
     // We always rebuild complete "style" string,
     //  so no list of "removed" items
     getSelectedItem(gDialog.AddCSSAttributeTree).remove();
 
     ClearCSSInputWidgets();
   }
 }
 
-function SelectCSSTree( index )
-{
+function SelectCSSTree(index) {
   gDoOnSelectTree = false;
   try {
     gDialog.AddCSSAttributeTree.selectedIndex = index;
   } catch (e) {}
   gDoOnSelectTree = true;
 }
--- a/editor/ui/dialogs/content/EdAEHTMLAttributes.js
+++ b/editor/ui/dialogs/content/EdAEHTMLAttributes.js
@@ -1,169 +1,144 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-function BuildHTMLAttributeNameList()
-{
+function BuildHTMLAttributeNameList() {
   gDialog.AddHTMLAttributeNameInput.removeAllItems();
 
   var elementName = gElement.localName;
   var attNames = gHTMLAttr[elementName];
 
-  if (attNames && attNames.length)
-  {
+  if (attNames && attNames.length) {
     var menuitem;
 
-    for (var i = 0; i < attNames.length; i++)
-    {
+    for (var i = 0; i < attNames.length; i++) {
       var name = attNames[i];
 
-      if (name == "_core")
-      {
+      if (name == "_core") {
         // Signal to append the common 'core' attributes.
-        for (var j = 0; j < gCoreHTMLAttr.length; j++)
-        {
+        for (var j = 0; j < gCoreHTMLAttr.length; j++) {
           name = gCoreHTMLAttr[j];
 
           // only filtering rule used for core attributes as of 8-20-01
           // Add more rules if necessary.
-          if (name.includes("^"))
-          {
+          if (name.includes("^")) {
             name = name.replace(/\^/g, "");
             menuitem = gDialog.AddHTMLAttributeNameInput.appendItem(name, name);
             menuitem.setAttribute("limitFirstChar", "true");
-          }
-          else
+          } else
             gDialog.AddHTMLAttributeNameInput.appendItem(name, name);
         }
-      }
-      else if (name == "-")
-      {
+      } else if (name == "-") {
         // Signal for separator
         var popup = gDialog.AddHTMLAttributeNameInput.menupopup;
-        if (popup)
-        {
+        if (popup) {
           var sep = document.createElementNS(XUL_NS, "menuseparator");
           if (sep)
             popup.appendChild(sep);
         }
-      }
-      else
-      {
+      } else {
         // Get information about value filtering
         let forceOneChar = name.includes("!");
         let forceInteger = name.includes("#");
         let forceSignedInteger = name.includes("+");
         let forceIntOrPercent = name.includes("%");
         let limitFirstChar = name.includes("\^");
-        //let required = name.includes("$");
+        // let required = name.includes("$");
 
         // Strip flag characters
         name = name.replace(/[!^#%$+]/g, "");
 
         menuitem = gDialog.AddHTMLAttributeNameInput.appendItem(name, name);
-        if (menuitem)
-        {
+        if (menuitem) {
           // Signify "required" attributes by special style
-          //TODO: Don't do this until next version, when we add
+          // TODO: Don't do this until next version, when we add
           //      explanatory text and an 'Autofill Required Attributes' button
-          //if (required)
+          // if (required)
           //  menuitem.setAttribute("class", "menuitem-highlight-1");
 
           // Set flags to filter value input
           if (forceOneChar)
-            menuitem.setAttribute("forceOneChar","true");
+            menuitem.setAttribute("forceOneChar", "true");
           if (limitFirstChar)
             menuitem.setAttribute("limitFirstChar", "true");
           if (forceInteger)
             menuitem.setAttribute("forceInteger", "true");
           if (forceSignedInteger)
             menuitem.setAttribute("forceSignedInteger", "true");
           if (forceIntOrPercent)
             menuitem.setAttribute("forceIntOrPercent", "true");
         }
       }
     }
   }
 }
 
 // build attribute list in tree form from element attributes
-function BuildHTMLAttributeTable()
-{
+function BuildHTMLAttributeTable() {
   var nodeMap = gElement.attributes;
   var i;
-  if (nodeMap.length > 0)
-  {
+  if (nodeMap.length > 0) {
     var added = false;
-    for(i = 0; i < nodeMap.length; i++)
-    {
+    for (i = 0; i < nodeMap.length; i++) {
       let name = nodeMap[i].name.trim().toLowerCase();
-      if ( CheckAttributeNameSimilarity( nodeMap[i].nodeName, HTMLAttrs ) ||
-           name.startsWith("on") || name == "style" ) {
+      if (CheckAttributeNameSimilarity(nodeMap[i].nodeName, HTMLAttrs) ||
+           name.startsWith("on") || name == "style") {
         continue;   // repeated or non-HTML attribute, ignore this one and go to next
       }
       if (!name.startsWith("_moz") &&
-          AddTreeItem(name, nodeMap[i].value, "HTMLAList", HTMLAttrs))
-      {
+          AddTreeItem(name, nodeMap[i].value, "HTMLAList", HTMLAttrs)) {
         added = true;
       }
     }
 
     if (added)
       SelectHTMLTree(0);
   }
 }
 
-function ClearHTMLInputWidgets()
-{
+function ClearHTMLInputWidgets() {
   gDialog.AddHTMLAttributeTree.view.selection.clearSelection();
-  gDialog.AddHTMLAttributeNameInput.value ="";
+  gDialog.AddHTMLAttributeNameInput.value = "";
   gDialog.AddHTMLAttributeValueInput.value = "";
   SetTextboxFocus(gDialog.AddHTMLAttributeNameInput);
 }
 
-function onSelectHTMLTreeItem()
-{
+function onSelectHTMLTreeItem() {
   if (!gDoOnSelectTree)
     return;
 
   var tree = gDialog.AddHTMLAttributeTree;
-  if (tree && tree.view.selection.count)
-  {
+  if (tree && tree.view.selection.count) {
     var inputName = TrimString(gDialog.AddHTMLAttributeNameInput.value).toLowerCase();
     var selectedItem = getSelectedItem(tree);
     var selectedName = selectedItem.firstChild.firstChild.getAttribute("label");
 
-    if (inputName == selectedName)
-    {
+    if (inputName == selectedName) {
       // Already editing selected name - just update the value input
       gDialog.AddHTMLAttributeValueInput.value = GetTreeItemValueStr(selectedItem);
-    }
-    else
-    {
+    } else {
       gDialog.AddHTMLAttributeNameInput.value = selectedName;
 
       // Change value input based on new selected name
       onInputHTMLAttributeName();
     }
   }
 }
 
-function onInputHTMLAttributeName()
-{
+function onInputHTMLAttributeName() {
   let attName = gDialog.AddHTMLAttributeNameInput.value.toLowerCase().trim();
 
   // Clear value widget, but prevent triggering update in tree
   gUpdateTreeValue = false;
   gDialog.AddHTMLAttributeValueInput.value = "";
   gUpdateTreeValue = true;
 
-  if (attName)
-  {
+  if (attName) {
     // Get value list for current attribute name
     var valueListName;
 
     // Most elements have the "dir" attribute,
     //   so we have just one array for the allowed values instead
     //   requiring duplicate entries for each element in EdAEAttributes.js
     if (attName == "dir")
       valueListName = "all_dir";
@@ -175,58 +150,51 @@ function onInputHTMLAttributeName()
       valueListName = valueListName.slice(1);
 
     var newValue = "";
     var listLen = 0;
 
     // Index to which widget we were using to edit the value
     var deckIndex = gDialog.AddHTMLAttributeValueDeck.getAttribute("selectedIndex");
 
-    if (valueListName in gHTMLAttr)
-    {
+    if (valueListName in gHTMLAttr) {
       var valueList = gHTMLAttr[valueListName];
 
       listLen = valueList.length;
       if (listLen == 1)
         newValue = valueList[0];
 
       // Note: For case where "value list" is actually just
       // one (default) item, don't use menulist for that
-      if (listLen > 1)
-      {
+      if (listLen > 1) {
         gDialog.AddHTMLAttributeValueMenulist.removeAllItems();
 
-        if (deckIndex != "1")
-        {
+        if (deckIndex != "1") {
           // Switch to using editable menulist
           gDialog.AddHTMLAttributeValueInput = gDialog.AddHTMLAttributeValueMenulist;
           gDialog.AddHTMLAttributeValueDeck.setAttribute("selectedIndex", "1");
         }
         // Rebuild the list
-        for (var i = 0; i < listLen; i++)
-        {
-          if (valueList[i] == "-")
-          {
+        for (var i = 0; i < listLen; i++) {
+          if (valueList[i] == "-") {
             // Signal for separator
             var popup = gDialog.AddHTMLAttributeValueInput.menupopup;
-            if (popup)
-            {
+            if (popup) {
               var sep = document.createElementNS(XUL_NS, "menuseparator");
               if (sep)
                 popup.appendChild(sep);
             }
           } else {
             gDialog.AddHTMLAttributeValueMenulist.appendItem(valueList[i], valueList[i]);
           }
         }
       }
     }
 
-    if (listLen <= 1 && deckIndex != "0")
-    {
+    if (listLen <= 1 && deckIndex != "0") {
       // No list: Use textbox for input instead
       gDialog.AddHTMLAttributeValueInput = gDialog.AddHTMLAttributeValueTextbox;
       gDialog.AddHTMLAttributeValueDeck.setAttribute("selectedIndex", "0");
     }
 
     // If attribute already exists in tree, use associated value,
     //  else use default found above
     var existingValue = GetAndSelectExistingAttributeValue(attName, "HTMLAList");
@@ -235,133 +203,116 @@ function onInputHTMLAttributeName()
 
     gDialog.AddHTMLAttributeValueInput.value = newValue;
 
     if (!existingValue)
       onInputHTMLAttributeValue();
   }
 }
 
-function onInputHTMLAttributeValue()
-{
+function onInputHTMLAttributeValue() {
   if (!gUpdateTreeValue)
     return;
 
   var name = TrimString(gDialog.AddHTMLAttributeNameInput.value);
   if (!name)
     return;
 
   // Trim spaces only from left since we must allow spaces within the string
   //  (we always reset the input field's value below)
   var value = TrimStringLeft(gDialog.AddHTMLAttributeValueInput.value);
-  if (value)
-  {
+  if (value) {
     // Do value filtering based on type of attribute
     // (Do not use "forceInteger()" to avoid multiple
     //  resetting of input's value and flickering)
     var selectedItem = gDialog.AddHTMLAttributeNameInput.selectedItem;
 
-    if (selectedItem)
-    {
-      if ( selectedItem.getAttribute("forceOneChar") == "true" &&
-           value.length > 1 )
+    if (selectedItem) {
+      if (selectedItem.getAttribute("forceOneChar") == "true" &&
+           value.length > 1)
         value = value.slice(0, 1);
 
-      if ( selectedItem.getAttribute("forceIntOrPercent") == "true" )
-      {
+      if (selectedItem.getAttribute("forceIntOrPercent") == "true") {
         // Allow integer with optional "%" as last character
         var percent = TrimStringRight(value).slice(-1);
-        value = value.replace(/\D+/g,"");
+        value = value.replace(/\D+/g, "");
         if (percent == "%")
           value += percent;
-      }
-      else if ( selectedItem.getAttribute("forceInteger") == "true" )
-      {
-        value = value.replace(/\D+/g,"");
-      }
-      else if ( selectedItem.getAttribute("forceSignedInteger") == "true" )
-      {
+      } else if (selectedItem.getAttribute("forceInteger") == "true") {
+        value = value.replace(/\D+/g, "");
+      } else if (selectedItem.getAttribute("forceSignedInteger") == "true") {
         // Allow integer with optional "+" or "-" as first character
         var sign = value[0];
-        value = value.replace(/\D+/g,"");
+        value = value.replace(/\D+/g, "");
         if (sign == "+" || sign == "-")
           value = sign + value;
       }
 
       // Special case attributes
-      if (selectedItem.getAttribute("limitFirstChar") == "true")
-      {
+      if (selectedItem.getAttribute("limitFirstChar") == "true") {
         // Limit first character to letter, and all others to
         //  letters, numbers, and a few others
-        value = value.replace(/^[^a-zA-Z\u0080-\uFFFF]/, "").replace(/[^a-zA-Z0-9_\.\-\:\u0080-\uFFFF]+/g,'');
+        value = value.replace(/^[^a-zA-Z\u0080-\uFFFF]/, "").replace(/[^a-zA-Z0-9_\.\-\:\u0080-\uFFFF]+/g, "");
       }
 
       // Update once only if it changed
       if (value != gDialog.AddHTMLAttributeValueInput.value)
         gDialog.AddHTMLAttributeValueInput.value = value;
     }
   }
 
   // Update value in the tree list
   // If not found, add new attribute
   if (!UpdateExistingAttribute(name, value, "HTMLAList") && value)
     AddTreeItem(name, value, "HTMLAList", HTMLAttrs);
 }
 
-function editHTMLAttributeValue(targetCell)
-{
+function editHTMLAttributeValue(targetCell) {
   if (IsNotTreeHeader(targetCell))
     gDialog.AddHTMLAttributeValueInput.select();
 }
 
 
 // update the object with added and removed attributes
-function UpdateHTMLAttributes()
-{
+function UpdateHTMLAttributes() {
   var HTMLAList = document.getElementById("HTMLAList");
   var i;
 
   // remove removed attributes
-  for (i = 0; i < HTMLRAttrs.length; i++)
-  {
+  for (i = 0; i < HTMLRAttrs.length; i++) {
     var name = HTMLRAttrs[i];
 
     if (gElement.hasAttribute(name))
       doRemoveAttribute(name);
   }
 
   // Set added or changed attributes
-  for( i = 0; i < HTMLAList.childNodes.length; i++)
-  {
+  for (i = 0; i < HTMLAList.childNodes.length; i++) {
     var item = HTMLAList.childNodes[i];
-    doSetAttribute( GetTreeItemAttributeStr(item), GetTreeItemValueStr(item));
+    doSetAttribute(GetTreeItemAttributeStr(item), GetTreeItemValueStr(item));
   }
 }
 
-function RemoveHTMLAttribute()
-{
+function RemoveHTMLAttribute() {
   // We only allow 1 selected item
-  if (gDialog.AddHTMLAttributeTree.view.selection.count)
-  {
+  if (gDialog.AddHTMLAttributeTree.view.selection.count) {
     var item = getSelectedItem(gDialog.AddHTMLAttributeTree);
     var attr = GetTreeItemAttributeStr(item);