Bug 1577835 - Reformat editor/ code with eslint and Prettier draft
authorPaul Morris <paul@thunderbird.net>
Fri, 30 Aug 2019 15:45:11 -0400
changeset 78346 8bb9f5cd56566f6f05cd75256d0f4962026ddee0
parent 78345 ddd97a5f889b75d8a4fafcdea341d085cea3bac8
child 78347 026d3ab20202372c3bbd71ae82bca099acfa52f2
push id9209
push userpaul@paulwmorris.com
push dateSat, 31 Aug 2019 12:58:28 +0000
treeherdertry-comm-central@365deb5d9f12 [default view] [failures only]
bugs1577835
Bug 1577835 - Reformat editor/ code with eslint and Prettier # ignore-this-changeset These changes were achieved by: 1. Using eslint to add curly brackets to control statements that did not have them (if, else, etc.), thanks to the eslint rule: "curly": ["error", "all"] Done by running |mach eslint editor/ --fix| 2. Reformatting the code using Prettier. Done by deleting the editor/ line from the .prettierignore file and running: |mach eslint editor/ --fix|
.prettierignore
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/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/nsComposerCmdLineHandler.js
--- a/.prettierignore
+++ b/.prettierignore
@@ -6,12 +6,11 @@
 *.xhtml
 *.xul
 *.xml
 
 # Ignore .eslintrc.js for now.
 .eslintrc.js
 
 # Ignore all top-level directories that contain JS files (for now).
-editor/**
 mail/**
 mailnews/**
 suite/**
--- a/editor/ui/composer/content/ComposerCommands.js
+++ b/editor/ui/composer/content/ComposerCommands.js
@@ -10,146 +10,203 @@
 
 /* import-globals-from editor.js */
 /* import-globals-from editorUtilities.js */
 
 var gComposerJSCommandControllerID = 0;
 
 function SetupHTMLEditorCommands() {
   var commandTable = GetComposerCommandTable();
-  if (!commandTable)
+  if (!commandTable) {
     return;
+  }
 
   // Include everything a text editor does
   SetupTextEditorCommands();
 
   // 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_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_removeNamedAnchors", nsRemoveNamedAnchorsCommand);
+  commandTable.registerCommand(
+    "cmd_advancedProperties",
+    nsAdvancedPropertiesCommand
+  );
+  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_insertHTMLWithDialog", nsInsertHTMLWithDialogCommand);
-  commandTable.registerCommand("cmd_insertMathWithDialog", nsInsertMathWithDialogCommand);
+  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_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_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_DeleteCellContents", nsDeleteTableCellContentsCommand);
+  commandTable.registerCommand(
+    "cmd_DeleteCellContents",
+    nsDeleteTableCellContentsCommand
+  );
   commandTable.registerCommand("cmd_JoinTableCells", nsJoinTableCellsCommand);
   commandTable.registerCommand("cmd_SplitTableCell", nsSplitTableCellCommand);
-  commandTable.registerCommand("cmd_TableOrCellColor", nsTableOrCellColorCommand);
+  commandTable.registerCommand(
+    "cmd_TableOrCellColor",
+    nsTableOrCellColorCommand
+  );
   commandTable.registerCommand("cmd_NormalizeTable", nsNormalizeTableCommand);
   commandTable.registerCommand("cmd_smiley", nsSetSmiley);
   commandTable.registerCommand("cmd_ConvertToTable", nsConvertToTable);
 }
 
 function SetupTextEditorCommands() {
   var commandTable = GetComposerCommandTable();
-  if (!commandTable)
+  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);
   commandTable.registerCommand("cmd_checkLinks", nsCheckLinksCommand);
   commandTable.registerCommand("cmd_insertChars", nsInsertCharsCommand);
 }
 
 function SetupComposerWindowCommands() {
   // Don't need to do this if already done
-  if (gComposerWindowControllerID)
+  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
   // IMPORTANT: For each of these commands, the doCommand method
   //            must first call SetEditMode(gPreviousNonSourceDisplayMode);
   //            to go from HTML Source mode to any other edit mode
 
   var windowControllers = window.controllers;
 
-  if (!windowControllers) return;
+  if (!windowControllers) {
+    return;
+  }
 
   var commandTable;
   var composerController;
   var editorController;
   try {
-    composerController = Cc["@mozilla.org/embedcomp/base-command-controller;1"].createInstance();
-
-    editorController = composerController.QueryInterface(Ci.nsIControllerContext);
+    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);
+    var interfaceRequestor = composerController.QueryInterface(
+      Ci.nsIInterfaceRequestor
+    );
+    commandTable = interfaceRequestor.getInterface(
+      Ci.nsIControllerCommandTable
+    );
   } catch (e) {
     dump("Failed to create composerController\n");
     return;
   }
 
-
   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_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);
@@ -161,60 +218,78 @@ function SetupComposerWindowCommands() {
   // 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);
-    commandTable.registerCommand("cmd_updateStructToolbar", nsUpdateStructToolbarCommand);
+    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);
+  gComposerWindowControllerID = windowControllers.getControllerId(
+    editorController
+  );
 }
 
 function GetComposerCommandTable() {
   var controller;
   if (gComposerJSCommandControllerID) {
     try {
-      controller = window.content.controllers.getControllerById(gComposerJSCommandControllerID);
+      controller = window.content.controllers.getControllerById(
+        gComposerJSCommandControllerID
+      );
     } catch (e) {}
   }
   if (!controller) {
     // create it
-    controller = Cc["@mozilla.org/embedcomp/base-command-controller;1"].createInstance();
+    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);
+    gComposerJSCommandControllerID = window.content.controllers.getControllerId(
+      controller
+    );
   }
 
   if (controller) {
-    var interfaceRequestor = controller.QueryInterface(Ci.nsIInterfaceRequestor);
+    var interfaceRequestor = controller.QueryInterface(
+      Ci.nsIInterfaceRequestor
+    );
     return interfaceRequestor.getInterface(Ci.nsIControllerCommandTable);
   }
   return null;
 }
 
 /* eslint-disable complexity */
 function goUpdateCommandState(command) {
   try {
-    var controller = top.document.commandDispatcher.getControllerForCommand(command);
-    if (!(controller instanceof Ci.nsICommandController))
+    var controller = top.document.commandDispatcher.getControllerForCommand(
+      command
+    );
+    if (!(controller instanceof Ci.nsICommandController)) {
       return;
+    }
 
     var params = newCommandParams();
-    if (!params) return;
+    if (!params) {
+      return;
+    }
 
     controller.getCommandStateWithParams(command, params);
 
     switch (command) {
       case "cmd_bold":
       case "cmd_italic":
       case "cmd_underline":
       case "cmd_var":
@@ -253,79 +328,88 @@ 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");
+    dump(
+      "An error occurred updating the " + command + " command: \n" + e + "\n"
+    );
   }
 }
 /* eslint-enable complexity */
 
 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) {
-      goUpdateCommand(commandID);  // enable or disable
-      if (commandNode.hasAttribute("state"))
+      goUpdateCommand(commandID); // enable or disable
+      if (commandNode.hasAttribute("state")) {
         goUpdateCommandState(commandID);
+      }
     }
   }
 }
 
 function goDoCommandParams(command, params) {
   try {
-    var controller = top.document.commandDispatcher.getControllerForCommand(command);
+    var controller = top.document.commandDispatcher.getControllerForCommand(
+      command
+    );
     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)
+        if (params) {
           controller.getCommandStateWithParams(command, params);
+        }
       } else {
         controller.doCommand(command);
       }
       ResetStructToolbar();
     }
   } catch (e) {
     dump("An error occurred executing the " + command + " command\n");
   }
 }
 
 function pokeStyleUI(uiID, aDesiredState) {
   try {
     var commandNode = top.document.getElementById(uiID);
-    if (!commandNode)
+    if (!commandNode) {
       return;
-
-    var uiState = ("true" == commandNode.getAttribute("state"));
+    }
+
+    var uiState = "true" == commandNode.getAttribute("state");
     if (aDesiredState != uiState) {
       commandNode.setAttribute("state", aDesiredState ? "true" : "false");
     }
   } catch (e) {
     dump("poking UI for " + uiID + " failed: " + e + "\n");
   }
 }
 
 function doStyleUICommand(cmdStr) {
   try {
     var cmdParams = newCommandParams();
     goDoCommandParams(cmdStr, cmdParams);
-    if (cmdParams)
+    if (cmdParams) {
       pokeStyleUI(cmdStr, cmdParams.getBooleanValue("state_all"));
+    }
 
     ResetStructToolbar();
   } catch (e) {}
 }
 
 // Copied from jsmime.js.
 function stringToTypedArray(buffer) {
   var typedarray = new Uint8Array(buffer.length);
@@ -333,94 +417,100 @@ function stringToTypedArray(buffer) {
     typedarray[i] = buffer.charCodeAt(i);
   }
   return typedarray;
 }
 
 function pokeMultiStateUI(uiID, cmdParams) {
   try {
     var commandNode = document.getElementById(uiID);
-    if (!commandNode)
+    if (!commandNode) {
       return;
+    }
 
     var isMixed = cmdParams.getBooleanValue("state_mixed");
     var desiredAttrib;
     if (isMixed) {
       desiredAttrib = "mixed";
     } else {
       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));
+        desiredAttrib = new TextDecoder("UTF-8").decode(
+          stringToTypedArray(desiredAttrib)
+        );
       } else {
         desiredAttrib = cmdParams.getStringValue("state_attribute");
       }
     }
 
     var uiState = commandNode.getAttribute("state");
     if (desiredAttrib != uiState) {
       commandNode.setAttribute("state", desiredAttrib);
     }
   } catch (e) {}
 }
 
 function doStatefulCommand(commandID, newState) {
   var commandNode = document.getElementById(commandID);
-  if (commandNode)
-      commandNode.setAttribute("state", newState);
-  gContentWindow.focus();   // needed for command dispatch to work
+  if (commandNode) {
+    commandNode.setAttribute("state", newState);
+  }
+  gContentWindow.focus(); // needed for command dispatch to work
 
   try {
     var cmdParams = newCommandParams();
-    if (!cmdParams) return;
+    if (!cmdParams) {
+      return;
+    }
 
     cmdParams.setStringValue("state_attribute", newState);
     goDoCommandParams(commandID, cmdParams);
 
     pokeMultiStateUI(commandID, cmdParams);
 
     ResetStructToolbar();
   } catch (e) {
     dump("error thrown in doStatefulCommand: " + e + "\n");
   }
 }
 
 function PrintObject(obj) {
   dump("-----" + obj + "------\n");
   var names = "";
   for (var i in obj) {
-    if (i == "value")
+    if (i == "value") {
       names += i + ": " + obj.value + "\n";
-    else if (i == "id")
+    } else if (i == "id") {
       names += i + ": " + obj.id + "\n";
-    else
+    } else {
       names += i + "\n";
+    }
   }
 
   dump(names + "-----------\n");
 }
 
 function PrintNodeID(id) {
   PrintObject(document.getElementById(id));
 }
 
 var nsDummyHTMLCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     // do nothing
     dump("Hey, who's calling the dummy command?\n");
   },
-
 };
 
 /* eslint-disable */
 var nsOpenCommand = {
   isCommandEnabled(aCommand, dummy) {
     return true;    // we can always do this
   },
 
@@ -474,88 +564,103 @@ var nsUpdateStructToolbarCommand = {
 // ******* File output commands and utilities ******** //
 var nsSaveCommand = {
   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");
+      return (
+        IsDocumentEditable() &&
+        (IsDocumentModified() ||
+          IsHTMLSourceChanged() ||
+          IsUrlAboutBlank(docUrl) ||
+          GetScheme(docUrl) != "file")
+      );
     } catch (e) {
       return false;
     }
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     var editor = GetCurrentEditor();
     if (editor) {
-      if (IsHTMLEditor())
+      if (IsHTMLEditor()) {
         SetEditMode(gPreviousNonSourceDisplayMode);
-      SaveDocument(IsUrlAboutBlank(GetDocumentUrl()), false, editor.contentsMIMEType);
+      }
+      SaveDocument(
+        IsUrlAboutBlank(GetDocumentUrl()),
+        false,
+        editor.contentsMIMEType
+      );
     }
   },
 };
 
 var nsSaveAsCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable());
+    return IsDocumentEditable();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     var editor = GetCurrentEditor();
     if (editor) {
-      if (IsHTMLEditor())
+      if (IsHTMLEditor()) {
         SetEditMode(gPreviousNonSourceDisplayMode);
+      }
       SaveDocument(true, false, editor.contentsMIMEType);
     }
   },
 };
 
 var nsExportToTextCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable());
+    return IsDocumentEditable();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     if (GetCurrentEditor()) {
       SetEditMode(gPreviousNonSourceDisplayMode);
       SaveDocument(true, true, "text/plain");
     }
   },
 };
 
 var nsSaveAndChangeEncodingCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable());
+    return IsDocumentEditable();
   },
 
   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");
-
-    if (GetDocumentTitle() != oldTitle)
+    window.openDialog(
+      "chrome://editor/content/EditorSaveAsCharset.xul",
+      "_blank",
+      "chrome,close,titlebar,modal,resizable=yes"
+    );
+
+    if (GetDocumentTitle() != oldTitle) {
       UpdateWindowTitle();
+    }
 
     if (window.ok) {
       if (window.exportToText) {
         SaveDocument(true, true, "text/plain");
       } else {
         var editor = GetCurrentEditor();
         SaveDocument(true, false, editor ? editor.contentsMIMEType : null);
       }
@@ -622,158 +727,188 @@ var nsPublishCommand = {
     }
     return false;
   },
 };
 /* eslint-enable */
 
 var nsPublishAsCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable());
+    return IsDocumentEditable();
   },
 
   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",
-                        "chrome,close,titlebar,modal", "", "", publishData);
-      if (GetDocumentTitle() != oldTitle)
+      window.openDialog(
+        "chrome://editor/content/EditorPublish.xul",
+        "_blank",
+        "chrome,close,titlebar,modal",
+        "",
+        "",
+        publishData
+      );
+      if (GetDocumentTitle() != oldTitle) {
         UpdateWindowTitle();
-
-      if (window.ok)
+      }
+
+      if (window.ok) {
         return Publish(publishData);
+      }
     }
     return false;
   },
 };
 
 // ------- output utilities   ----- //
 
 // returns a fileExtension string
 function GetExtensionBasedOnMimeType(aMIMEType) {
   try {
     var mimeService = null;
-    mimeService = Cc["@mozilla.org/mime;1"]
-                    .getService(Ci.nsIMIMEService);
+    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")
+    if (fileExtension == "htm") {
       fileExtension = "html";
+    }
 
     return fileExtension;
   } catch (e) {}
   return "";
 }
 
 function GetSuggestedFileName(aDocumentURLString, aMIMEType) {
   var extension = GetExtensionBasedOnMimeType(aMIMEType);
-  if (extension)
+  if (extension) {
     extension = "." + extension;
+  }
 
   // check for existing file name we can use
   if (aDocumentURLString && !IsUrlAboutBlank(aDocumentURLString)) {
     try {
-      let docURI = Services.io.newURI(aDocumentURLString,
-        GetCurrentEditor().documentCharacterSet);
+      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)
+      if (url) {
         return url + extension;
+      }
     } 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");
+  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);
   } catch (e) {}
-  if (!fp) return dialogResult;
+  if (!fp) {
+    return dialogResult;
+  }
 
   // determine prompt string based on type of saving we'll do
   var promptString;
-  if (aDoSaveAsText || aEditorType == "text")
+  if (aDoSaveAsText || aEditorType == "text") {
     promptString = GetString("SaveTextAs");
-  else
+  } else {
     promptString = GetString("SaveDocumentAs");
+  }
 
   fp.init(window, promptString, nsIFilePicker.modeSave);
 
   // Set filters according to the type of output
-  if (aDoSaveAsText)
+  if (aDoSaveAsText) {
     fp.appendFilters(nsIFilePicker.filterText);
-  else
+  } else {
     fp.appendFilters(nsIFilePicker.filterHTML);
+  }
   fp.appendFilters(nsIFilePicker.filterAll);
 
   // now let's actually set the filepicker's suggested filename
   var suggestedFileName = GetSuggestedFileName(aDocumentURLString, aMIMEType);
-  if (suggestedFileName)
+  if (suggestedFileName) {
     fp.defaultString = suggestedFileName;
+  }
 
   // set the file picker's current directory
   // 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);
+      let docURI = Services.io.newURI(
+        aDocumentURLString,
+        GetCurrentEditor().documentCharacterSet
+      );
       isLocalFile = docURI.schemeIs("file");
     } catch (e) {}
 
     var parentLocation = null;
     if (isLocalFile) {
       var fileLocation = fileHandler.getFileFromURLSpec(aDocumentURLString); // this asserts if url is not local
       parentLocation = fileLocation.parent;
     }
     if (parentLocation) {
       // Save current filepicker's default location
-      if ("gFilePickerDirectory" in window)
+      if ("gFilePickerDirectory" in window) {
         gFilePickerDirectory = fp.displayDirectory;
+      }
 
       fp.displayDirectory = parentLocation;
     } else {
       // Initialize to the last-used directory for the particular type (saved in prefs)
       SetFilePickerDirectory(fp, aEditorType);
     }
   } catch (e) {}
 
   return new Promise(resolve => {
     fp.open(rv => {
       dialogResult.filepickerClick = rv;
-      if (rv != nsIFilePicker.returnCancel && fp.file) { // Allow OK and replace.
+      if (rv != nsIFilePicker.returnCancel && fp.file) {
+        // Allow OK and replace.
         // reset urlstring to new save location
-        dialogResult.resultingURIString = fileHandler.getURLSpecFromFile(fp.file);
+        dialogResult.resultingURIString = fileHandler.getURLSpecFromFile(
+          fp.file
+        );
         dialogResult.resultingLocalFile = fp.file;
         SaveFilePickerDirectory(fp, aEditorType);
         resolve(dialogResult);
       } else if ("gFilePickerDirectory" in window && gFilePickerDirectory) {
         fp.displayDirectory = gFilePickerDirectory;
         resolve(null);
       }
     });
@@ -782,42 +917,57 @@ function PromptForSaveLocation(aDoSaveAs
 
 /**
  * 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() {
-  if (GetDocumentTitle()) // we have a title; no need to prompt!
+  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});
-  if (confirmed)
+  let confirmed = Services.prompt.prompt(
+    window,
+    captionStr,
+    msgStr,
+    result,
+    null,
+    { value: 0 }
+  );
+  if (confirmed) {
     SetDocumentTitle(TrimString(result.value));
+  }
 
   return confirmed;
 }
 
 var gPersistObj;
 
 // Don't forget to do these things after calling OutputFileWithPersistAPI:
 // we need to update the uri before notifying listeners
 //    if (doUpdateURI)
 //      SetDocumentURI(docURI);
 //    UpdateWindowTitle();
 //    if (!aSaveCopy)
 //      editor.resetModificationCount();
-      // this should cause notification to listeners that document has changed
+// 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 {
@@ -827,82 +977,106 @@ function OutputFileWithPersistAPI(editor
     try {
       var tmp = aDestinationLocation.QueryInterface(Ci.nsIURI);
       isLocalFile = tmp.schemeIs("file");
     } 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);
+    var persistObj = Cc[
+      "@mozilla.org/embedding/browser/nsWebBrowserPersist;1"
+    ].createInstance(webPersist);
     persistObj.progressListener = gEditorOutputProgressListener;
 
     var wrapColumn = GetWrapColumn();
     var outputFlags = GetOutputFlags(aMimeType, wrapColumn);
 
     // for 4.x parity as well as improving readability of file locally on server
     // this will always send crlf for upload (http/ftp)
-    if (!isLocalFile) { // if we aren't saving locally then send both cr and lf
-      outputFlags |= webPersist.ENCODE_FLAGS_CR_LINEBREAKS | webPersist.ENCODE_FLAGS_LF_LINEBREAKS;
+    if (!isLocalFile) {
+      // if we aren't saving locally then send both cr and lf
+      outputFlags |=
+        webPersist.ENCODE_FLAGS_CR_LINEBREAKS |
+        webPersist.ENCODE_FLAGS_LF_LINEBREAKS;
 
       // we want to serialize the output for all remote publishing
       // some servers can handle only one connection at a time
       // some day perhaps we can make this user-configurable per site?
-      persistObj.persistFlags = persistObj.persistFlags | webPersist.PERSIST_FLAGS_SERIALIZE_OUTPUT;
+      persistObj.persistFlags =
+        persistObj.persistFlags | webPersist.PERSIST_FLAGS_SERIALIZE_OUTPUT;
     }
 
     // note: we always want to set the replace existing files flag since we have
     // already given user the chance to not replace an existing file (file picker)
     // or the user picked an option where the file is implicitly being replaced (save)
-    persistObj.persistFlags = persistObj.persistFlags
-                            | 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);
+    persistObj.persistFlags =
+      persistObj.persistFlags |
+      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;
   }
 
   return true;
 }
 
 // returns output flags based on mimetype, wrapCol and prefs
 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;
+  var outputEntity =
+    editor && editor.documentCharacterSet == "ISO-8859-1"
+      ? webPersist.ENCODE_FLAGS_ENCODE_LATIN1_ENTITIES
+      : webPersist.ENCODE_FLAGS_ENCODE_BASIC_ENTITIES;
   if (aMimeType == "text/plain") {
     // When saving in "text/plain" format, always do formatting
     outputFlags |= webPersist.ENCODE_FLAGS_FORMATTED;
   } else {
     // Should we prettyprint? Check the pref
-    if (Services.prefs.getBoolPref("editor.prettyprint"))
+    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 "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 "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;
       }
     } catch (e) {}
   }
   outputFlags |= outputEntity;
 
-  if (aWrapColumn > 0)
+  if (aWrapColumn > 0) {
     outputFlags |= webPersist.ENCODE_FLAGS_WRAP;
+  }
 
   return outputFlags;
 }
 
 // returns number of column where to wrap
 const nsIWebBrowserPersist = Ci.nsIWebBrowserPersist;
 function GetWrapColumn() {
   try {
@@ -1295,132 +1469,169 @@ var gEditorOutputProgressListener = {
     return ret;
   },
 };
 /* eslint-enable */
 
 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)
+  if (!gPublishData) {
     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) {
       // 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)
+      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);
+    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;
 }
 
 /* eslint-disable complexity */
 function DumpDebugStatus(aStatus) {
   // see nsError.h and netCore.h and ftpCore.h
 
-  if (aStatus == kErrorBindingAborted)
+  if (aStatus == kErrorBindingAborted) {
     dump("***** status is NS_BINDING_ABORTED\n");
-  else if (aStatus == kErrorBindingRedirected)
+  } else if (aStatus == kErrorBindingRedirected) {
     dump("***** status is NS_BINDING_REDIRECTED\n");
-  else if (aStatus == 2152398859) // in netCore.h 11
+  } else if (aStatus == 2152398859) {
+    // in netCore.h 11
     dump("***** status is ALREADY_CONNECTED\n");
-  else if (aStatus == 2152398860) // in netCore.h 12
+  } else if (aStatus == 2152398860) {
+    // in netCore.h 12
     dump("***** status is NOT_CONNECTED\n");
-  else if (aStatus == 2152398861) //  in nsISocketTransportService.idl 13
+  } else if (aStatus == 2152398861) {
+    //  in nsISocketTransportService.idl 13
     dump("***** status is CONNECTION_REFUSED\n");
-  else if (aStatus == 2152398862) // in nsISocketTransportService.idl 14
+  } else if (aStatus == 2152398862) {
+    // in nsISocketTransportService.idl 14
     dump("***** status is NET_TIMEOUT\n");
-  else if (aStatus == 2152398863) // in netCore.h 15
+  } else if (aStatus == 2152398863) {
+    // in netCore.h 15
     dump("***** status is IN_PROGRESS\n");
-  else if (aStatus == 2152398864) // 0x804b0010 in netCore.h 16
+  } else if (aStatus == 2152398864) {
+    // 0x804b0010 in netCore.h 16
     dump("***** status is OFFLINE\n");
-  else if (aStatus == 2152398865) // in netCore.h 17
+  } else if (aStatus == 2152398865) {
+    // in netCore.h 17
     dump("***** status is NO_CONTENT\n");
-  else if (aStatus == 2152398866) // in netCore.h 18
+  } else if (aStatus == 2152398866) {
+    // in netCore.h 18
     dump("***** status is UNKNOWN_PROTOCOL\n");
-  else if (aStatus == 2152398867) // in netCore.h 19
+  } else if (aStatus == 2152398867) {
+    // in netCore.h 19
     dump("***** status is PORT_ACCESS_NOT_ALLOWED\n");
-  else if (aStatus == 2152398868) // in nsISocketTransportService.idl 20
+  } else if (aStatus == 2152398868) {
+    // in nsISocketTransportService.idl 20
     dump("***** status is NET_RESET\n");
-  else if (aStatus == 2152398869) // in ftpCore.h 21
+  } else if (aStatus == 2152398869) {
+    // in ftpCore.h 21
     dump("***** status is FTP_LOGIN\n");
-  else if (aStatus == 2152398870) // in ftpCore.h 22
+  } else if (aStatus == 2152398870) {
+    // in ftpCore.h 22
     dump("***** status is FTP_CWD\n");
-  else if (aStatus == 2152398871) // in ftpCore.h 23
+  } else if (aStatus == 2152398871) {
+    // in ftpCore.h 23
     dump("***** status is FTP_PASV\n");
-  else if (aStatus == 2152398872) // in ftpCore.h 24
+  } else if (aStatus == 2152398872) {
+    // in ftpCore.h 24
     dump("***** status is FTP_PWD\n");
-  else if (aStatus == 2152857601)
+  } else if (aStatus == 2152857601) {
     dump("***** status is UNRECOGNIZED_PATH\n");
-  else if (aStatus == 2152857602)
+  } else if (aStatus == 2152857602) {
     dump("***** status is UNRESOLABLE SYMLINK\n");
-  else if (aStatus == 2152857604)
+  } else if (aStatus == 2152857604) {
     dump("***** status is UNKNOWN_TYPE\n");
-  else if (aStatus == 2152857605)
+  } else if (aStatus == 2152857605) {
     dump("***** status is DESTINATION_NOT_DIR\n");
-  else if (aStatus == 2152857606)
+  } else if (aStatus == 2152857606) {
     dump("***** status is TARGET_DOES_NOT_EXIST\n");
-  else if (aStatus == 2152857608)
+  } else if (aStatus == 2152857608) {
     dump("***** status is ALREADY_EXISTS\n");
-  else if (aStatus == 2152857609)
+  } else if (aStatus == 2152857609) {
     dump("***** status is INVALID_PATH\n");
-  else if (aStatus == 2152857610)
+  } else if (aStatus == 2152857610) {
     dump("***** status is DISK_FULL\n");
-  else if (aStatus == 2152857612)
+  } else if (aStatus == 2152857612) {
     dump("***** status is NOT_DIRECTORY\n");
-  else if (aStatus == 2152857613)
+  } else if (aStatus == 2152857613) {
     dump("***** status is IS_DIRECTORY\n");
-  else if (aStatus == 2152857614)
+  } else if (aStatus == 2152857614) {
     dump("***** status is IS_LOCKED\n");
-  else if (aStatus == 2152857615)
+  } else if (aStatus == 2152857615) {
     dump("***** status is TOO_BIG\n");
-  else if (aStatus == 2152857616)
+  } else if (aStatus == 2152857616) {
     dump("***** status is NO_DEVICE_SPACE\n");
-  else if (aStatus == 2152857617)
+  } else if (aStatus == 2152857617) {
     dump("***** status is NAME_TOO_LONG\n");
-  else if (aStatus == 2152857618) // 80520012
+  } else if (aStatus == 2152857618) {
+    // 80520012
     dump("***** status is FILE_NOT_FOUND\n");
-  else if (aStatus == 2152857619)
+  } else if (aStatus == 2152857619) {
     dump("***** status is READ_ONLY\n");
-  else if (aStatus == 2152857620)
+  } else if (aStatus == 2152857620) {
     dump("***** status is DIR_NOT_EMPTY\n");
-  else if (aStatus == 2152857621)
+  } else if (aStatus == 2152857621) {
     dump("***** status is ACCESS_DENIED\n");
-  else if (aStatus == 2152398878)
+  } else if (aStatus == 2152398878) {
     dump("***** status is ? (No connection or time out?)\n");
-  else
+  } else {
     dump("***** status is " + aStatus + "\n");
+  }
 }
 /* eslint-enable complexity */
 
 // Update any data that the user supplied in a prompt dialog
-function UpdateUsernamePasswordFromPrompt(publishData, username, password, savePassword) {
-  if (!publishData)
+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)
-                                && (savePassword || !publishData.notInSiteData);
+  publishData.savePublishData =
+    (gPublishData.username != username || gPublishData.password != password) &&
+    (savePassword || !publishData.notInSiteData);
 
   publishData.username = username;
   publishData.password = password;
   publishData.savePassword = savePassword;
 }
 
 const kSupportedTextMimeTypes = [
   "text/plain",
@@ -1433,18 +1644,19 @@ const kSupportedTextMimeTypes = [
   "application/ecmascript",
   "application/x-javascript",
   "text/xul",
   "application/vnd.mozilla.xul+xml",
 ];
 
 function IsSupportedTextMimeType(aMimeType) {
   for (var i = 0; i < kSupportedTextMimeTypes.length; i++) {
-    if (kSupportedTextMimeTypes[i] == aMimeType)
+    if (kSupportedTextMimeTypes[i] == aMimeType) {
       return true;
+    }
   }
   return false;
 }
 
 /* eslint-disable */
 /* eslint-disable complexity */
 // throws an error or returns true if user attempted save; false if user canceled save
 async function SaveDocument(aSaveAs, aSaveCopy, aMimeType) {
@@ -1605,53 +1817,87 @@ function SetDocumentURI(uri) {
 
 // -------------------------------  Publishing
 var gPublishData;
 var gProgressDialog;
 var gCommandAfterPublishing = null;
 var gRestoreDocumentSource;
 
 function Publish(publishData) {
-  if (!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) {
-    Services.prompt.alert(window, GetString("Publish"), GetString("PublishFailed"));
+    Services.prompt.alert(
+      window,
+      GetString("Publish"),
+      GetString("PublishFailed")
+    );
     return false;
   }
 
-  if (gPublishData.publishOtherFiles)
+  if (gPublishData.publishOtherFiles) {
     gPublishData.otherFilesURI = CreateURIFromPublishData(publishData, false);
-  else
+  } 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");
+    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) {
-    var message = GetString("PromptFTPUsernamePassword").replace(/%host%/, GetHost(publishData.publishUrl));
-    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
+    var message = GetString("PromptFTPUsernamePassword").replace(
+      /%host%/,
+      GetHost(publishData.publishUrl)
+    );
+    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) {
       gPublishData.otherFilesURI.username = publishData.username;
       gPublishData.otherFilesURI.password = publishData.password;
@@ -1659,19 +1905,23 @@ function Publish(publishData) {
   }
 
   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);
+    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;
 }
@@ -1680,24 +1930,29 @@ function StartPublishing() {
   var editor = GetCurrentEditor();
   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) {
       try {
-        gRestoreDocumentSource =
-          editor.outputToString(editor.contentsMIMEType, kOutputEncodeW3CEntities);
+        gRestoreDocumentSource = editor.outputToString(
+          editor.contentsMIMEType,
+          kOutputEncodeW3CEntities
+        );
       } catch (e) {}
     }
 
-    OutputFileWithPersistAPI(editor.document,
-                             gPublishData.docURI, gPublishData.otherFilesURI,
-                             editor.contentsMIMEType);
+    OutputFileWithPersistAPI(
+      editor.document,
+      gPublishData.docURI,
+      gPublishData.otherFilesURI,
+      editor.contentsMIMEType
+    );
     return gPersistObj;
   }
   return null;
 }
 
 function CancelPublishing() {
   try {
     gPersistObj.cancelSave();
@@ -1786,67 +2041,82 @@ function SetSaveAndPublishUI(urlstring) 
   goUpdateCommand("cmd_publish");
 }
 
 function SetDocumentEditable(isDocEditable) {
   var editor = GetCurrentEditor();
   if (editor && editor.document) {
     try {
       var flags = editor.flags;
-      editor.flags = isDocEditable ?
-            flags &= ~nsIPlaintextEditor.eEditorReadonlyMask :
-            flags | nsIPlaintextEditor.eEditorReadonlyMask;
+      editor.flags = isDocEditable
+        ? (flags &= ~nsIPlaintextEditor.eEditorReadonlyMask)
+        : flags | nsIPlaintextEditor.eEditorReadonlyMask;
     } catch (e) {}
 
     // update all commands
     window.updateCommands("create");
   }
 }
 
 // ****** end of save / publish **********//
 
 var nsPublishSettingsCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable());
+    return IsDocumentEditable();
   },
 
   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(aCommand, dummy) {
-    return (IsDocumentEditable() &&
-            IsDocumentModified() &&
-            !IsUrlAboutBlank(GetDocumentUrl()));
+    return (
+      IsDocumentEditable() &&
+      IsDocumentModified() &&
+      !IsUrlAboutBlank(GetDocumentUrl())
+    );
   },
 
   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 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});
+    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 }
+    );
 
     // Reload page if first button (Revert) was pressed
     if (result == 0) {
       CancelHTMLSource();
       EditorLoadUrl(GetDocumentUrl());
     }
   },
 };
@@ -1863,25 +2133,26 @@ var nsCloseCommand = {
     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 (window.InsertCharWindow)
+    if (window.InsertCharWindow) {
       SwitchInsertCharToAnotherEditorOrClose();
+    }
 
     try {
-      var basewin = window.getInterface(Ci.nsIWebNavigation)
-                          .QueryInterface(Ci.nsIDocShellTreeItem)
-                          .treeOwner
-                          .QueryInterface(Ci.nsIInterfaceRequestor)
-                          .getInterface(Ci.nsIBaseWindow);
+      var basewin = window
+        .getInterface(Ci.nsIWebNavigation)
+        .QueryInterface(Ci.nsIDocShellTreeItem)
+        .treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
+        .getInterface(Ci.nsIBaseWindow);
       basewin.destroy();
     } catch (e) {}
   }
 }
 
 /* eslint-disable */
 var nsOpenRemoteCommand = {
   isCommandEnabled(aCommand, dummy) {
@@ -1919,51 +2190,63 @@ var nsOpenRemoteCommand = {
         break;
     }
   },
 };
 /* eslint-enable */
 
 var nsPreviewCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() &&
-            IsHTMLEditor() &&
-            (DocumentHasBeenSaved() || IsDocumentModified()));
+    return (
+      IsDocumentEditable() &&
+      IsHTMLEditor() &&
+      (DocumentHasBeenSaved() || IsDocumentModified())
+    );
   },
 
   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())))
+    if (!(await CheckAndSaveDocument("cmd_preview", DocumentHasBeenSaved()))) {
       return;
+    }
 
     // Check if we saved again just in case?
     if (DocumentHasBeenSaved()) {
       let browser;
       try {
         // Find a browser with this URL
         let enumerator = Services.wm.getEnumerator("navigator:browser");
 
         var documentURI = GetDocumentUrl();
         while (enumerator.hasMoreElements()) {
           browser = enumerator.getNext();
-          if (browser && !browser.closed &&
-              (documentURI == browser.getBrowser().currentURI.spec))
+          if (
+            browser &&
+            !browser.closed &&
+            documentURI == browser.getBrowser().currentURI.spec
+          ) {
             break;
+          }
 
           browser = null;
         }
       } catch (ex) {}
 
       // If none found, open a new browser
       if (!browser) {
-        browser = window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", documentURI);
+        browser = window.openDialog(
+          getBrowserURL(),
+          "_blank",
+          "chrome,all,dialog=no",
+          documentURI
+        );
       } else {
         try {
           browser.BrowserReloadSkipCache();
           browser.focus();
         } catch (ex) {}
       }
     }
   },
@@ -1995,17 +2278,17 @@ var nsSendPageCommand = {
       }
     }
   },
 };
 /* eslint-enable */
 
 var nsPrintCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return true;    // we can always do this
+    return true; // we can always do this
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     // In editor.js
     SetEditMode(gPreviousNonSourceDisplayMode);
@@ -2032,17 +2315,17 @@ var nsPrintPreviewCommand = {
       PrintUtils.printPreview(PrintPreviewListener);
     } catch (e) {}
   },
 };
 /* eslint-enable */
 
 var nsPrintSetupCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return true;    // we can always do this
+    return true; // we can always do this
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     // In editor.js
     SetEditMode(gPreviousNonSourceDisplayMode);
@@ -2054,18 +2337,22 @@ var nsFindReplaceCommand = {
   isCommandEnabled(aCommand, editorElement) {
     return editorElement.getEditor(editorElement.contentWindow) != null;
   },
 
   getCommandStateParams(aCommand, aParams, editorElement) {},
   doCommandParams(aCommand, aParams, editorElement) {},
 
   doCommand(aCommand, editorElement) {
-    window.openDialog("chrome://editor/content/EdReplace.xul", "_blank",
-                      "chrome,modal,titlebar", editorElement);
+    window.openDialog(
+      "chrome://editor/content/EdReplace.xul",
+      "_blank",
+      "chrome,modal,titlebar",
+      editorElement
+    );
   },
 };
 
 var nsFindCommand = {
   isCommandEnabled(aCommand, editorElement) {
     return editorElement.getEditor(editorElement.contentWindow) != null;
   },
 
@@ -2083,50 +2370,64 @@ var nsFindAgainCommand = {
     // to get that from here
     return editorElement.getEditor(editorElement.contentWindow) != null;
   },
 
   getCommandStateParams(aCommand, aParams, editorElement) {},
   doCommandParams(aCommand, aParams, editorElement) {},
 
   doCommand(aCommand, editorElement) {
-    let findPrev = (aCommand == "cmd_findPrev");
+    let findPrev = aCommand == "cmd_findPrev";
     document.getElementById("FindToolbar").onFindAgainCommand(findPrev);
   },
 };
 
 var nsRewrapCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && !IsInHTMLSourceMode() &&
-            GetCurrentEditor() instanceof Ci.nsIEditorMailSupport);
+    return (
+      IsDocumentEditable() &&
+      !IsInHTMLSourceMode() &&
+      GetCurrentEditor() instanceof Ci.nsIEditorMailSupport
+    );
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    GetCurrentEditor().QueryInterface(Ci.nsIEditorMailSupport).rewrap(false);
+    GetCurrentEditor()
+      .QueryInterface(Ci.nsIEditorMailSupport)
+      .rewrap(false);
   },
 };
 
 var nsSpellingCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() &&
-            !IsInHTMLSourceMode() && IsSpellCheckerInstalled());
+    return (
+      IsDocumentEditable() && !IsInHTMLSourceMode() && IsSpellCheckerInstalled()
+    );
   },
 
   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);
+      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) {}
   },
 };
 
 // Validate using http://validator.w3.org/file-upload.html
 var URL2Validate;
 var nsValidateCommand = {
   isCommandEnabled(aCommand, dummy) {
@@ -2135,217 +2436,276 @@ var nsValidateCommand = {
 
   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 (!(await CheckAndSaveDocument("cmd_validate", false)))
+      if (!(await CheckAndSaveDocument("cmd_validate", false))) {
         return;
+      }
 
       // Check if we saved again just in case?
-      if (!DocumentHasBeenSaved())    // user hit cancel?
+      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) {
       URL2Validate = ifile.path;
-      var vwin = window.open("http://validator.w3.org/file-upload.html",
-                             "EditorValidate");
+      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 {
-      window.open(`http://validator.w3.org/check?uri=${URL2Validate}&doctype=Inline`,
-                  "EditorValidate");
+      window.open(
+        `http://validator.w3.org/check?uri=${URL2Validate}&doctype=Inline`,
+        "EditorValidate"
+      );
       // This does the validation, no need to wait for page loaded.
     }
   },
   validateFilePageLoaded(event) {
     event.target.forms[0].uploaded_file.value = URL2Validate;
   },
 };
 
 var nsCheckLinksCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable());
+    return IsDocumentEditable();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdLinkChecker.xul", "_blank", "chrome,close,titlebar,modal");
+    window.openDialog(
+      "chrome://editor/content/EdLinkChecker.xul",
+      "_blank",
+      "chrome,close,titlebar,modal"
+    );
   },
 };
 
 var nsFormCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdFormProps.xul", "_blank", "chrome,close,titlebar,modal");
+    window.openDialog(
+      "chrome://editor/content/EdFormProps.xul",
+      "_blank",
+      "chrome,close,titlebar,modal"
+    );
   },
 };
 
 var nsInputTagCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdInputProps.xul", "_blank", "chrome,close,titlebar,modal");
+    window.openDialog(
+      "chrome://editor/content/EdInputProps.xul",
+      "_blank",
+      "chrome,close,titlebar,modal"
+    );
   },
 };
 
 var nsInputImageCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdInputImage.xul", "_blank", "chrome,close,titlebar,modal");
+    window.openDialog(
+      "chrome://editor/content/EdInputImage.xul",
+      "_blank",
+      "chrome,close,titlebar,modal"
+    );
   },
 };
 
 var nsTextAreaCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdTextAreaProps.xul", "_blank", "chrome,close,titlebar,modal");
+    window.openDialog(
+      "chrome://editor/content/EdTextAreaProps.xul",
+      "_blank",
+      "chrome,close,titlebar,modal"
+    );
   },
 };
 
 var nsSelectCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdSelectProps.xul", "_blank", "chrome,close,titlebar,modal");
+    window.openDialog(
+      "chrome://editor/content/EdSelectProps.xul",
+      "_blank",
+      "chrome,close,titlebar,modal"
+    );
   },
 };
 
 var nsButtonCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdButtonProps.xul", "_blank", "chrome,close,titlebar,modal");
+    window.openDialog(
+      "chrome://editor/content/EdButtonProps.xul",
+      "_blank",
+      "chrome,close,titlebar,modal"
+    );
   },
 };
 
 var nsLabelCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   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) {
+        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);
+        window.openDialog(
+          "chrome://editor/content/EdLabelProps.xul",
+          "_blank",
+          "chrome,close,titlebar,modal",
+          labelElement
+        );
       } else {
         EditorSetTextProperty(tagName, "", "");
       }
     } catch (e) {}
   },
 };
 
 var nsFieldSetCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdFieldSetProps.xul", "_blank", "chrome,close,titlebar,modal");
+    window.openDialog(
+      "chrome://editor/content/EdFieldSetProps.xul",
+      "_blank",
+      "chrome,close,titlebar,modal"
+    );
   },
 };
 
 var nsIsIndexCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   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));
+      isindexElement.setAttribute(
+        "prompt",
+        editor.outputToString("text/plain", kOutputSelectionOnly)
+      );
       editor.insertElementAtSelection(isindexElement, true);
     } catch (e) {}
   },
 };
 
 var nsImageCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdImageProps.xul", "_blank", "chrome,close,titlebar,modal");
+    window.openDialog(
+      "chrome://editor/content/EdImageProps.xul",
+      "_blank",
+      "chrome,close,titlebar,modal"
+    );
   },
 };
 
 var nsHLineCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   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
@@ -2358,202 +2718,250 @@ var nsHLineCommand = {
     try {
       hLine = editor.getSelectedElement(tagName);
     } 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");
+      window.openDialog(
+        "chrome://editor/content/EdHLineProps.xul",
+        "_blank",
+        "chrome,close,titlebar,modal"
+      );
     } 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)
+        if (align == 0) {
           editor.setAttributeOrEquivalent(hLine, "align", "left", true);
-        else if (align == 2)
+        } else if (align == 2) {
           editor.setAttributeOrEquivalent(hLine, "align", "right", true);
+        }
 
         // Note: Default is center (don't write attribute)
 
         let width = Services.prefs.getIntPref("editor.hrule.width");
-        if (Services.prefs.getBoolPref("editor.hrule.width_percent"))
+        if (Services.prefs.getBoolPref("editor.hrule.width_percent")) {
           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"))
+        if (Services.prefs.getBoolPref("editor.hrule.shading")) {
           hLine.removeAttribute("noshade");
-        else
+        } else {
           hLine.setAttribute("noshade", "noshade");
+        }
 
         editor.insertElementAtSelection(hLine, true);
       } catch (e) {}
     }
   },
 };
 
 var nsLinkCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   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);
-    else
-      window.openDialog("chrome://editor/content/EdLinkProps.xul", "_blank", "chrome,close,titlebar,modal");
+    if (element && element.nodeName.toLowerCase() == "img") {
+      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"
+      );
+    }
   },
 };
 
 var nsAnchorCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdNamedAnchorProps.xul", "_blank", "chrome,close,titlebar,modal", "");
+    window.openDialog(
+      "chrome://editor/content/EdNamedAnchorProps.xul",
+      "_blank",
+      "chrome,close,titlebar,modal",
+      ""
+    );
   },
 };
 
 var nsInsertHTMLWithDialogCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdInsSrc.xul", "_blank", "chrome,close,titlebar,modal,resizable", "");
+    window.openDialog(
+      "chrome://editor/content/EdInsSrc.xul",
+      "_blank",
+      "chrome,close,titlebar,modal,resizable",
+      ""
+    );
   },
 };
 
 var nsInsertMathWithDialogCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdInsertMath.xul", "_blank", "chrome,close,titlebar,modal,resizable", "");
+    window.openDialog(
+      "chrome://editor/content/EdInsertMath.xul",
+      "_blank",
+      "chrome,close,titlebar,modal,resizable",
+      ""
+    );
   },
 };
 
 var nsInsertCharsCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable());
+    return IsDocumentEditable();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     EditorFindOrCreateInsertCharWindow();
   },
 };
 
 var nsInsertBreakCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     try {
       GetCurrentEditor().insertHTML("<br>");
     } catch (e) {}
   },
 };
 
 var nsInsertBreakAllCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     try {
       GetCurrentEditor().insertHTML("<br clear='all'>");
     } catch (e) {}
   },
 };
 
 var nsGridCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdSnapToGrid.xul", "_blank", "chrome,close,titlebar,modal");
+    window.openDialog(
+      "chrome://editor/content/EdSnapToGrid.xul",
+      "_blank",
+      "chrome,close,titlebar,modal"
+    );
   },
 };
 
 var nsListPropertiesCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdListProps.xul", "_blank", "chrome,close,titlebar,modal");
+    window.openDialog(
+      "chrome://editor/content/EdListProps.xul",
+      "_blank",
+      "chrome,close,titlebar,modal"
+    );
   },
 };
 
 var nsPagePropertiesCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   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)
+    if (GetDocumentTitle() != oldTitle) {
       UpdateWindowTitle();
+    }
   },
 };
 
 var nsObjectPropertiesCommand = {
   isCommandEnabled(aCommand, dummy) {
     var isEnabled = false;
     if (IsDocumentEditable() && IsEditingRenderedHTML()) {
-      isEnabled = (GetObjectForProperties() != null ||
-                   GetCurrentEditor().getSelectedElement("href") != null);
+      isEnabled =
+        GetObjectForProperties() != null ||
+        GetCurrentEditor().getSelectedElement("href") != null;
     }
     return isEnabled;
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
@@ -2568,20 +2976,21 @@ var nsObjectPropertiesCommand = {
         case "hr":
           goDoCommand("cmd_hline");
           break;
         case "form":
           goDoCommand("cmd_form");
           break;
         case "input":
           var type = element.getAttribute("type");
-          if (type && type.toLowerCase() == "image")
+          if (type && type.toLowerCase() == "image") {
             goDoCommand("cmd_inputimage");
-          else
+          } else {
             goDoCommand("cmd_inputtag");
+          }
           break;
         case "textarea":
           goDoCommand("cmd_textarea");
           break;
         case "select":
           goDoCommand("cmd_select");
           break;
         case "button":
@@ -2620,186 +3029,220 @@ var nsObjectPropertiesCommand = {
           doAdvancedProperties(element);
           break;
       }
     } else {
       // We get a partially-selected link if asked for specifically
       try {
         element = GetCurrentEditor().getSelectedElement("href");
       } catch (e) {}
-      if (element)
+      if (element) {
         goDoCommand("cmd_link");
+      }
     }
   },
 };
 
 var nsSetSmiley = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {
     var smileyCode = aParams.getStringValue("state_attribute");
 
     var strSml;
     switch (smileyCode) {
-        case ":-)": strSml = "s1";
+      case ":-)":
+        strSml = "s1";
+        break;
+      case ":-(":
+        strSml = "s2";
         break;
-        case ":-(": strSml = "s2";
+      case ";-)":
+        strSml = "s3";
         break;
-        case ";-)": strSml = "s3";
+      case ":-P":
+      case ":-p":
+      case ":-b":
+        strSml = "s4";
         break;
-        case ":-P":
-        case ":-p":
-        case ":-b": strSml = "s4";
+      case ":-D":
+        strSml = "s5";
         break;
-        case ":-D": strSml = "s5";
+      case ":-[":
+        strSml = "s6";
         break;
-        case ":-[": strSml = "s6";
+      case ":-/":
+      case ":/":
+      case ":-\\":
+      case ":\\":
+        strSml = "s7";
         break;
-        case ":-/":
-        case ":/":
-        case ":-\\":
-        case ":\\": strSml = "s7";
+      case "=-O":
+      case "=-o":
+        strSml = "s8";
         break;
-        case "=-O":
-        case "=-o": strSml = "s8";
-        break;
-        case ":-*": strSml = "s9";
+      case ":-*":
+        strSml = "s9";
         break;
-        case ">:o":
-        case ">:-o": strSml = "s10";
+      case ">:o":
+      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:-)":
+      case "o:-)":
+        strSml = "s14";
         break;
-        case ":'(": strSml = "s15";
+      case ":'(":
+        strSml = "s15";
         break;
-        case ":-X":
-        case ":-x": strSml = "s16";
+      case ":-X":
+      case ":-x":
+        strSml = "s16";
         break;
-        default: strSml = "";
+      default:
+        strSml = "";
         break;
     }
 
     try {
       var editor = GetCurrentEditor();
       var extElement = editor.createElementWithDefaults("span");
       extElement.setAttribute("class", "moz-smiley-" + strSml);
 
       var intElement = editor.createElementWithDefaults("span");
-      if (!intElement)
+      if (!intElement) {
         return;
-
-      var txtElement =  editor.document.createTextNode(smileyCode);
-      if (!txtElement)
+      }
+
+      var txtElement = editor.document.createTextNode(smileyCode);
+      if (!txtElement) {
         return;
+      }
 
       intElement.appendChild(txtElement);
       extElement.appendChild(intElement);
 
-
       editor.insertElementAtSelection(extElement, true);
       window.content.focus();
     } catch (e) {
-        dump("Exception occurred in smiley InsertElementAtSelection\n");
+      dump("Exception occurred in smiley InsertElementAtSelection\n");
     }
   },
   // This is now deprecated in favor of "doCommandParams"
   doCommand(aCommand) {},
 };
 
 function doAdvancedProperties(element) {
   if (element) {
-    window.openDialog("chrome://editor/content/EdAdvancedEdit.xul", "_blank", "chrome,close,titlebar,modal,resizable=yes", "", element);
+    window.openDialog(
+      "chrome://editor/content/EdAdvancedEdit.xul",
+      "_blank",
+      "chrome,close,titlebar,modal,resizable=yes",
+      "",
+      element
+    );
   }
 }
 
 var nsAdvancedPropertiesCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   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(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    window.openDialog("chrome://editor/content/EdColorProps.xul", "_blank", "chrome,close,titlebar,modal", "");
+    window.openDialog(
+      "chrome://editor/content/EdColorProps.xul",
+      "_blank",
+      "chrome,close,titlebar,modal",
+      ""
+    );
     UpdateDefaultColors();
   },
 };
 
 var nsIncreaseFontCommand = {
   isCommandEnabled(aCommand, dummy) {
-    if (!(IsDocumentEditable() && IsEditingRenderedHTML()))
+    if (!(IsDocumentEditable() && IsEditingRenderedHTML())) {
       return false;
+    }
     var setIndex = getFontSizeIndex();
-    return (setIndex >= 0 && setIndex < 5);
+    return setIndex >= 0 && setIndex < 5;
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     var setIndex = getFontSizeIndex();
-    if (setIndex < 0 || setIndex >= 5)
+    if (setIndex < 0 || setIndex >= 5) {
       return;
-    var sizes = ["x-small", "small", "medium", "large", "x-large", "xx-large" ];
+    }
+    var sizes = ["x-small", "small", "medium", "large", "x-large", "xx-large"];
     EditorSetFontSize(sizes[setIndex + 1]);
   },
 };
 
 var nsDecreaseFontCommand = {
   isCommandEnabled(aCommand, dummy) {
-    if (!(IsDocumentEditable() && IsEditingRenderedHTML()))
+    if (!(IsDocumentEditable() && IsEditingRenderedHTML())) {
       return false;
+    }
     var setIndex = getFontSizeIndex();
-    return (setIndex > 0);
+    return setIndex > 0;
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     var setIndex = getFontSizeIndex();
-    if (setIndex <= 0)
+    if (setIndex <= 0) {
       return;
-    var sizes = ["x-small", "small", "medium", "large", "x-large", "xx-large" ];
+    }
+    var sizes = ["x-small", "small", "medium", "large", "x-large", "xx-large"];
     EditorSetFontSize(sizes[setIndex - 1]);
   },
 };
 
 var nsRemoveNamedAnchorsCommand = {
   isCommandEnabled(aCommand, dummy) {
     // We could see if there's any link in selection, but it doesn't seem worth the work!
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     EditorRemoveTextProperty("name", "");
     window.content.focus();
@@ -2837,66 +3280,67 @@ var nsNormalModeCommand = {
 
   doCommand(aCommand) {
     SetEditMode(kDisplayModeNormal);
   },
 };
 
 var nsAllTagsModeCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsHTMLEditor());
+    return IsDocumentEditable() && IsHTMLEditor();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     SetEditMode(kDisplayModeAllTags);
   },
 };
 
 var nsHTMLSourceModeCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsHTMLEditor());
+    return IsDocumentEditable() && IsHTMLEditor();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     SetEditMode(kDisplayModeSource);
   },
 };
 
 var nsPreviewModeCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsHTMLEditor());
+    return IsDocumentEditable() && IsHTMLEditor();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     SetEditMode(kDisplayModePreview);
   },
 };
 
 var nsInsertOrEditTableCommand = {
   isCommandEnabled(aCommand, dummy) {
-    return (IsDocumentEditable() && IsEditingRenderedHTML());
+    return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
-    if (IsInTableCell())
+    if (IsInTableCell()) {
       EditorTableCellProperties();
-    else
+    } else {
       EditorInsertOrEditTable(true);
+    }
   },
 };
 
 var nsEditTableCommand = {
   isCommandEnabled(aCommand, dummy) {
     return IsInTable();
   },
 
@@ -3119,18 +3563,19 @@ var nsDeleteTableRowCommand = {
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     var rows = GetNumberOfContiguousSelectedRows();
     // Delete at least one row
-    if (rows == 0)
+    if (rows == 0) {
       rows = 1;
+    }
 
     try {
       var editor = GetCurrentTableEditor();
       editor.beginTransaction();
 
       // Loop to delete all blocks of contiguous, selected rows
       while (rows) {
         editor.deleteTableRow(rows);
@@ -3149,18 +3594,19 @@ var nsDeleteTableColumnCommand = {
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     var columns = GetNumberOfContiguousSelectedColumns();
     // Delete at least one column
-    if (columns == 0)
+    if (columns == 0) {
       columns = 1;
+    }
 
     try {
       var editor = GetCurrentTableEditor();
       editor.beginTransaction();
 
       // Loop to delete all blocks of contiguous, selected columns
       while (columns) {
         editor.deleteTableColumn(columns);
@@ -3230,38 +3676,43 @@ var nsJoinTableCellsCommand = {
         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;
+          if (countObj.value > 1) {
+            return true;
+          }
 
           var colSpan = cell.getAttribute("colspan");
 
           // getAttribute returns string, we need number
           // no attribute means colspan = 1
-          if (!colSpan)
+          if (!colSpan) {
             colSpan = Number(1);
-          else
+          } else {
             colSpan = Number(colSpan);
+          }
 
           var rowObj = { value: 0 };
           var colObj = { value: 0 };
           editor.getCellIndexes(cell, rowObj, colObj);
 
           // Test if cell exists to the right of current cell
           // (cells with 0 span should never have cells to the right
           //  if there is, user can select the 2 cells to join them)
-          return (colSpan && editor.getCellAt(null, rowObj.value,
-                                              colObj.value + colSpan));
+          return (
+            colSpan &&
+            editor.getCellAt(null, rowObj.value, colObj.value + colSpan)
+          );
         }
       } catch (e) {}
     }
     return false;
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
@@ -3277,30 +3728,39 @@ var nsJoinTableCellsCommand = {
 
 var nsSplitTableCellCommand = {
   isCommandEnabled(aCommand, dummy) {
     if (IsDocumentEditable() && IsEditingRenderedHTML()) {
       var tagNameObj = { value: "" };
       var countObj = { value: 0 };
       var cell;
       try {
-        cell = GetCurrentTableEditor().getSelectedOrParentTableElement(tagNameObj, countObj);
+        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") &&
-           countObj.value <= 1 &&
-           IsSelectionInOneCell()) {
+      if (
+        cell &&
+        tagNameObj.value == "td" &&
+        countObj.value <= 1 &&
+        IsSelectionInOneCell()
+      ) {
         var colSpan = cell.getAttribute("colspan");
         var rowSpan = cell.getAttribute("rowspan");
-        if (!colSpan) colSpan = 1;
-        if (!rowSpan) rowSpan = 1;
-        return (colSpan > 1 || rowSpan > 1 ||
-                colSpan == 0 || rowSpan == 0);
+        if (!colSpan) {
+          colSpan = 1;
+        }
+        if (!rowSpan) {
+          rowSpan = 1;
+        }
+        return colSpan > 1 || rowSpan > 1 || colSpan == 0 || rowSpan == 0;
       }
     }
     return false;
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
@@ -3379,37 +3839,46 @@ var nsConvertToTable = {
       if (selection && !selection.isCollapsed) {
         // Don't allow if table or cell is the selection
         var element;
         try {
           element = GetCurrentEditor().getSelectedElement("");
         } catch (e) {}
         if (element) {
           var name = element.nodeName.toLowerCase();
-          if (name == "td" ||
-              name == "th" ||
-              name == "caption" ||
-              name == "table")
+          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))
+        if (
+          GetParentTableCell(selection.focusNode) !=
+          GetParentTableCell(selection.anchorNode)
+        ) {
           return false;
+        }
 
         return true;
       }
     }
     return false;
   },
 
   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");
+      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
@@ -3,105 +3,142 @@
  * 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/. */
 
 /* import-globals-from ../../../../mail/base/content/utilityOverlay.js */
 /* import-globals-from ComposerCommands.js */
 /* import-globals-from editorUtilities.js */
 /* globals InlineSpellCheckerUI */
 
-var {GetNextUntitledValue} = ChromeUtils.import("resource:///modules/editorUtilities.jsm");
-var {Async} = ChromeUtils.import("resource://services-common/async.js");
-var {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
+var { GetNextUntitledValue } = ChromeUtils.import(
+  "resource:///modules/editorUtilities.jsm"
+);
+var { Async } = ChromeUtils.import("resource://services-common/async.js");
+var { AppConstants } = ChromeUtils.import(
+  "resource://gre/modules/AppConstants.jsm"
+);
 
 /* Main Composer window UI control */
 
 var gComposerWindowControllerID = 0;
 var prefAuthorString = "";
 
 var kDisplayModeNormal = 0;
 var kDisplayModeAllTags = 1;
 var kDisplayModeSource = 2;
 var kDisplayModePreview = 3;
 
-const kDisplayModeMenuIDs = ["viewNormalMode", "viewAllTagsMode", "viewSourceMode", "viewPreviewMode"];
-const kDisplayModeTabIDS = ["NormalModeButton", "TagModeButton", "SourceModeButton", "PreviewModeButton"];
+const kDisplayModeMenuIDs = [
+  "viewNormalMode",
+  "viewAllTagsMode",
+  "viewSourceMode",
+  "viewPreviewMode",
+];
+const kDisplayModeTabIDS = [
+  "NormalModeButton",
+  "TagModeButton",
+  "SourceModeButton",
+  "PreviewModeButton",
+];
 const kNormalStyleSheet = "chrome://editor/content/EditorContent.css";
 const kAllTagsStyleSheet = "chrome://editor/content/EditorAllTags.css";
 const kContentEditableStyleSheet = "resource://gre/res/contenteditable.css";
 
 var kTextMimeType = "text/plain";
 var kHTMLMimeType = "text/html";
 var kXHTMLMimeType = "application/xhtml+xml";
 
 var gPreviousNonSourceDisplayMode = 1;
 var gEditorDisplayMode = -1;
-var gDocWasModified = false;  // Check if clean document, if clean then unload when user "Opens"
+var gDocWasModified = false; // Check if clean document, if clean then unload when user "Opens"
 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 kUseCssPref = "editor.use_css";
 var kCRInParagraphsPref = "editor.CR_creates_new_p";
 
 function ShowHideToolbarSeparators(toolbar) {
   // Make sure the toolbar actually exists.
-  if (!toolbar)
+  if (!toolbar) {
     return;
+  }
   var childNodes = toolbar.childNodes;
   var separator = null;
   var hideSeparator = true;
   for (var i = 0; childNodes[i].localName != "spacer"; i++) {
     if (childNodes[i].localName == "toolbarseparator") {
-      if (separator)
+      if (separator) {
         separator.hidden = true;
+      }
       separator = childNodes[i];
     } else if (!childNodes[i].hidden) {
-      if (separator)
+      if (separator) {
         separator.hidden = hideSeparator;
+      }
       separator = null;
       hideSeparator = false;
     }
   }
 }
 
 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)
+    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) {
   this.startup(prefName);
 }
@@ -120,21 +157,23 @@ nsPrefListener.prototype = {
   shutdown() {
     try {
       Services.prefs.removeObserver(this.domain, this);
     } catch (ex) {
       dump("Failed to remove pref observers: " + ex + "\n");
     }
   },
   observe(subject, topic, prefName) {
-    if (!IsHTMLEditor())
+    if (!IsHTMLEditor()) {
       return;
+    }
     // verify that we're changing a button pref
-    if (topic != "nsPref:changed")
+    if (topic != "nsPref:changed") {
       return;
+    }
 
     let editor = GetCurrentEditor();
     if (prefName == kUseCssPref) {
       let cmd = document.getElementById("cmd_highlight");
       if (cmd) {
         let useCSS = Services.prefs.getBoolPref(prefName);
 
         if (useCSS && editor) {
@@ -142,28 +181,31 @@ nsPrefListener.prototype = {
           let state = editor.getHighlightColorState(mixedObj);
           cmd.setAttribute("state", state);
           cmd.collapsed = false;
         } else {
           cmd.setAttribute("state", "transparent");
           cmd.collapsed = true;
         }
 
-        if (editor)
+        if (editor) {
           editor.isCSSEnabled = useCSS;
+        }
       }
     } 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)) {
-      editor.returnInParagraphCreatesNewParagraph = Services.prefs.getBoolPref(prefName);
+    } else if (editor && prefName == kCRInParagraphsPref) {
+      editor.returnInParagraphCreatesNewParagraph = Services.prefs.getBoolPref(
+        prefName
+      );
     }
   },
 };
 
 const gSourceTextListener = {
   NotifyDocumentCreated() {},
   NotifyDocumentWillBeDestroyed() {},
   NotifyDocumentStateChanged(isChanged) {
@@ -201,83 +243,94 @@ var DocumentReloadListener = {
   },
 };
 
 // implements nsIObserver
 var gEditorDocumentObserver = {
   observe(aSubject, aTopic, aData) {
     // Should we allow this even if NOT the focused editor?
     var commandManager = GetCurrentCommandManager();
-    if (commandManager != aSubject)
+    if (commandManager != aSubject) {
       return;
+    }
 
     var editor = GetCurrentEditor();
     switch (aTopic) {
       case "obs_documentCreated":
         // Just for convenience
         gContentWindow = window.content;
 
         // Get state to see if document creation succeeded
         var params = newCommandParams();
-        if (!params)
+        if (!params) {
           return;
+        }
 
         try {
           commandManager.getCommandState(aTopic, gContentWindow, params);
           var errorStringId = 0;
           var editorStatus = params.getLongValue("state_data");
           if (!editor && editorStatus == nsIEditingSession.eEditorOK) {
-            dump("\n ****** NO EDITOR BUT NO EDITOR ERROR REPORTED ******* \n\n");
+            dump(
+              "\n ****** NO EDITOR BUT NO EDITOR ERROR REPORTED ******* \n\n"
+            );
             editorStatus = nsIEditingSession.eEditorErrorUnknown;
           }
 
           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)
+          if (errorStringId) {
             Services.prompt.alert(window, "", GetString(errorStringId));
+          }
         } 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)
+        if (editorStatus) {
           return;
-
-        if (!("InsertCharWindow" in window))
+        }
+
+        if (!("InsertCharWindow" in window)) {
           window.InsertCharWindow = null;
+        }
 
         try {
           editor.QueryInterface(nsIEditorStyleSheets);
 
           //  and extra styles for showing anchors, table borders, smileys, etc
           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()) {
           InlineSpellCheckerUI.init(editor);
-          document.getElementById("menu_inlineSpellCheck").setAttribute("disabled", !InlineSpellCheckerUI.canSpellCheck);
-
-          editor.returnInParagraphCreatesNewParagraph = Services.prefs.getBoolPref(kCRInParagraphsPref);
+          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);
 
           // Call EditorSetDefaultPrefsAndDoctype first so it gets the default author before initing toolbars
           editor.enableUndo(false);
@@ -307,36 +360,39 @@ var gEditorDocumentObserver = {
             HideItem("linkButton");
             HideItem("namedAnchorButton");
             HideItem("hlineButton");
             HideItem("tableButton");
 
             HideItem("fileExportToText");
             HideItem("previewInBrowser");
 
-/* XXX When paste actually converts formatted rich text to pretty formatted plain text
+            /* XXX When paste actually converts formatted rich text to pretty formatted plain text
        and pasteNoFormatting is fixed to paste the text without formatting (what paste
        currently does), then this item shouldn't be hidden: */
             HideItem("menu_pasteNoFormatting");
 
             HideItem("cmd_viewFormatToolbar");
             HideItem("cmd_viewEditModeToolbar");
 
             HideItem("viewSep1");
             HideItem("viewNormalMode");
             HideItem("viewAllTagsMode");
             HideItem("viewSourceMode");
             HideItem("viewPreviewMode");
 
             HideItem("structSpacer");
 
             // Hide everything in "Insert" except for "Symbols"
-            let menuPopupChildren = document.querySelectorAll('[id="insertMenuPopup"] > :not(#insertChars)');
-            for (let i = 0; i < menuPopupChildren.length; i++)
+            let menuPopupChildren = document.querySelectorAll(
+              '[id="insertMenuPopup"] > :not(#insertChars)'
+            );
+            for (let i = 0; i < menuPopupChildren.length; i++) {
               menuPopupChildren.item(i).hidden = true;
+            }
           }
 
           // Set window title
           UpdateWindowTitle();
 
           // We must wait until document is created to get proper Url
           // (Windows may load with local file paths)
           SetSaveAndPublishUI(GetDocumentUrl());
@@ -359,22 +415,23 @@ var gEditorDocumentObserver = {
 
       case "obs_documentWillBeDestroyed":
         dump("obs_documentWillBeDestroyed notification\n");
         break;
 
       case "obs_documentLocationChanged":
         // Ignore this when editor doesn't exist,
         //   which happens once when page load starts
-        if (editor)
+        if (editor) {
           try {
             editor.updateBaseURL();
           } 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;
@@ -405,30 +462,43 @@ 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.
-  if (IsHTMLEditor())
+  if (IsHTMLEditor()) {
     SetupHTMLEditorCommands();
-  else
+  } else {
     SetupTextEditorCommands();
+  }
 
   // add observer to be called when document is really done loading
   // and is modified
   // Note: We're really screwed if we fail to install this observer!
   try {
     var commandManager = GetCurrentCommandManager();
-    commandManager.addCommandObserver(gEditorDocumentObserver, "obs_documentCreated");
-    commandManager.addCommandObserver(gEditorDocumentObserver, "cmd_setDocumentModified");
-    commandManager.addCommandObserver(gEditorDocumentObserver, "obs_documentWillBeDestroyed");
-    commandManager.addCommandObserver(gEditorDocumentObserver, "obs_documentLocationChanged");
+    commandManager.addCommandObserver(
+      gEditorDocumentObserver,
+      "obs_documentCreated"
+    );
+    commandManager.addCommandObserver(
+      gEditorDocumentObserver,
+      "cmd_setDocumentModified"
+    );
+    commandManager.addCommandObserver(
+      gEditorDocumentObserver,
+      "obs_documentWillBeDestroyed"
+    );
+    commandManager.addCommandObserver(
+      gEditorDocumentObserver,
+      "obs_documentLocationChanged"
+    );
 
     // Until nsIControllerCommandGroup-based code is implemented,
     //  we will observe just the bold command to trigger update of
     //  all toolbar style items
     commandManager.addCommandObserver(gEditorDocumentObserver, "cmd_bold");
   } catch (e) {
     dump(e);
   }
@@ -464,57 +534,61 @@ function EditorSharedStartup() {
 
   // For new window, no default last-picked colors
   gColorObj.LastTextColor = "";
   gColorObj.LastBackgroundColor = "";
   gColorObj.LastHighlightColor = "";
 }
 
 function SafeSetAttribute(nodeID, attributeName, attributeValue) {
-    var theNode = document.getElementById(nodeID);
-    if (theNode)
-        theNode.setAttribute(attributeName, attributeValue);
+  var theNode = document.getElementById(nodeID);
+  if (theNode) {
+    theNode.setAttribute(attributeName, attributeValue);
+  }
 }
 
 function DocumentHasBeenSaved() {
   var fileurl = "";
   try {
     fileurl = GetDocumentUrl();
   } catch (e) {
     return false;
   }
 
-  if (!fileurl || IsUrlAboutBlank(fileurl))
+  if (!fileurl || IsUrlAboutBlank(fileurl)) {
     return false;
+  }
 
   // We have a file URL already
   return true;
 }
 
 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)
+    if (!document) {
       return true;
+    }
   } catch (e) {
     return true;
   }
 
-  if (!IsDocumentModified() && !IsHTMLSourceChanged())
+  if (!IsDocumentModified() && !IsHTMLSourceChanged()) {
     return true;
+  }
 
   // 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 doPublish = scheme && scheme != "file";
 
   var strID;
   switch (command) {
     case "cmd_close":
       strID = "BeforeClosing";
       break;
     case "cmd_preview":
       strID = "BeforePreview";
@@ -528,39 +602,54 @@ 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};
-  let promptFlags = Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1;
+  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) {
-    promptFlags += Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0;
+    promptFlags +=
+      Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0;
     button1Title = GetString("Publish");
     button3Title = GetString("DontPublish");
   } else {
-    promptFlags += Services.prompt.BUTTON_TITLE_SAVE * Services.prompt.BUTTON_POS_0;
+    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 (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) {
     // Save, but first finish HTML source mode
     SetEditMode(gPreviousNonSourceDisplayMode);
     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
@@ -568,52 +657,57 @@ async function CheckAndSaveDocument(comm
       goDoCommand("cmd_publish");
       return false;
     }
 
     // Save to local disk
     return SaveDocument(false, false, editor.contentsMIMEType);
   }
 
-  if (result == 2) // "Don't Save"
+  if (result == 2) {
+    // "Don't Save"
     return true;
+  }
 
   // Default or result == 1 (Cancel)
   return false;
 }
 
 // --------------------------- View menu ---------------------------
 
 function EditorSetCharacterSet(aEvent) {
   try {
     var editor = GetCurrentEditor();
-    if (aEvent.target.hasAttribute("charset"))
+    if (aEvent.target.hasAttribute("charset")) {
       editor.documentCharacterSet = aEvent.target.getAttribute("charset");
+    }
     var docUrl = GetDocumentUrl();
     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);
       EditorLoadUrl(docUrl);
     }
   } catch (e) {}
 }
 
 // --------------------------- Text style ---------------------------
 
 function onParagraphFormatChange(paraMenuList, commandID) {
-  if (!paraMenuList)
+  if (!paraMenuList) {
     return;
+  }
 
   var commandNode = document.getElementById(commandID);
   var state = commandNode.getAttribute("state");
 
   // force match with "normal"
-  if (state == "body")
+  if (state == "body") {
     state = "";
+  }
 
   if (state == "mixed") {
     // Selection is the "mixed" ( > 1 style) state
     paraMenuList.selectedItem = null;
     paraMenuList.setAttribute("label", GetString("Mixed"));
   } else {
     var menuPopup = document.getElementById("ParagraphPopup");
     var menuItems = menuPopup.childNodes;
@@ -640,46 +734,54 @@ function onFontFaceChange(fontFaceMenuLi
 
   // 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"));
-    return;
-  case "":
-  case "serif":
-  case "sans-serif":
-    // Generic variable width.
-    fontFaceMenuList.selectedIndex = 0;
-    return;
-  case "tt":
-  case "monospace":
-    // Generic fixed width.
-    fontFaceMenuList.selectedIndex = 1;
-    return;
-  default:
+    case "mixed":
+      // Selection is the "mixed" ( > 1 style) state.
+      fontFaceMenuList.selectedItem = null;
+      fontFaceMenuList.setAttribute("label", GetString("Mixed"));
+      return;
+    case "":
+    case "serif":
+    case "sans-serif":
+      // Generic variable width.
+      fontFaceMenuList.selectedIndex = 0;
+      return;
+    case "tt":
+    case "monospace":
+      // Generic fixed width.
+      fontFaceMenuList.selectedIndex = 1;
+      return;
+    default:
   }
 
   let menuPopup = fontFaceMenuList.menupopup;
   let menuItems = menuPopup.childNodes;
 
-  const genericFamilies = [ "serif", "sans-serif", "monospace", "fantasy", "cursive" ];
+  const genericFamilies = [
+    "serif",
+    "sans-serif",
+    "monospace",
+    "fantasy",
+    "cursive",
+  ];
   // Bug 1139524: Normalise before we compare: Make it lower case
   // and replace ", " with "," so that entries like
   // "Helvetica, Arial, sans-serif" are always recognised correctly
   let editorFontToLower = editorFont.toLowerCase().replace(/, /g, ",");
   let foundFont = null;
   let exactMatch = false;
-  let usedFontsSep = menuPopup.querySelector("menuseparator.fontFaceMenuAfterUsedFonts");
+  let usedFontsSep = menuPopup.querySelector(
+    "menuseparator.fontFaceMenuAfterUsedFonts"
+  );
   let editorFontOptions = editorFontToLower.split(",");
   let editorOptionsCount = editorFontOptions.length;
   let matchedFontIndex = editorOptionsCount; // initialise to high invalid value
 
   // The font menu has this structure:
   // 0: Variable Width
   // 1: Fixed Width
   // 2: Separator
@@ -696,80 +798,107 @@ function onFontFaceChange(fontFaceMenuLi
   // 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++) {
     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))) {
+      if (
+        fontMenuValue == editorFontToLower ||
+        (menuItem.hasAttribute("value_cache") &&
+          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) {
         // 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) {
           // 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)
+          if (matchPos == 0) {
             break;
+          }
         }
       }
-    } else if (menuItem == usedFontsSep) { // Some other element type.
+    } else if (menuItem == usedFontsSep) {
+      // Some other element type.
       // We have now passed the section of used fonts and are now in the list of all.
       afterUsedFontSection = true;
     }
   }
 
   if (foundFont) {
-    let defaultFontsSep = menuPopup.querySelector("menuseparator.fontFaceMenuAfterDefaultFonts");
+    let defaultFontsSep = menuPopup.querySelector(
+      "menuseparator.fontFaceMenuAfterDefaultFonts"
+    );
     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 {
       // 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(",");
+      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() + '"]');
+      if (afterUsedFontSection) {
+        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)
+      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"))
+      if (foundFont.hasAttribute("value_cache")) {
         fontCache = foundFont.getAttribute("value_cache");
-      foundFont.setAttribute("value_cache", fontCache + "|" + editorFontToLower);
+      }
+      foundFont.setAttribute(
+        "value_cache",
+        fontCache + "|" + editorFontToLower
+      );
 
       // 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);
       }
     }
@@ -785,35 +914,38 @@ function onFontFaceChange(fontFaceMenuLi
   }
   fontFaceMenuList.selectedItem = foundFont;
 }
 
 /**
  * Clears the used fonts list from all the font face menulists.
  */
 function ClearUsedFonts() {
-  let userFontSeps = document.querySelectorAll("menuseparator.fontFaceMenuAfterDefaultFonts");
+  let userFontSeps = document.querySelectorAll(
+    "menuseparator.fontFaceMenuAfterDefaultFonts"
+  );
   for (let userFontSep of userFontSeps) {
     while (true) {
       let nextNode = userFontSep.nextSibling;
       if (nextNode.tagName != "menuseparator") {
         nextNode.remove();
       } else if (nextNode.classList.contains("fontFaceMenuAfterUsedFonts")) {
-          nextNode.hidden = true;
-          break;
-        }
+        nextNode.hidden = true;
+        break;
+      }
     }
   }
 }
 
 function EditorSelectFontSize() {
   var select = document.getElementById("FontSizeSelect");
   if (select) {
-    if (select.selectedIndex == -1)
+    if (select.selectedIndex == -1) {
       return;
+    }
 
     EditorSetFontSize(gFontSizeNames[select.selectedIndex]);
   }
 }
 
 function onFontSizeChange(fontSizeMenulist, commandID) {
   // If we don't match anything, set to "0 (normal)"
   var newIndex = 2;
@@ -824,23 +956,23 @@ function onFontSizeChange(fontSizeMenuli
   } else {
     for (var i = 0; i < gFontSizeNames.length; i++) {
       if (gFontSizeNames[i] == size) {
         newIndex = i;
         break;
       }
     }
   }
-  if (fontSizeMenulist.selectedIndex != newIndex)
+  if (fontSizeMenulist.selectedIndex != newIndex) {
     fontSizeMenulist.selectedIndex = newIndex;
+  }
 }
 
 function EditorSetFontSize(size) {
-  if (size == "0" || size == "normal" ||
-      size == "medium") {
+  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) {
@@ -866,79 +998,87 @@ function EditorSetFontSize(size) {
   gContentWindow.focus();
 }
 
 function initFontFaceMenu(menuPopup) {
   initLocalFontFaceMenu(menuPopup);
 
   if (menuPopup) {
     var children = menuPopup.childNodes;
-    if (!children) return;
+    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) {
-      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
+        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 matchedOption = editorFontOptions.length;  // initialise to high invalid value
+    var matchedOption = editorFontOptions.length; // initialise to high invalid value
     for (var i = 0; i < children.length; i++) {
       var menuItem = children[i];
       if (menuItem.localName == "menuitem") {
         var matchFound = false;
         if (!mixed.value) {
-          var menuFont = menuItem.getAttribute("value").toLowerCase().replace(/, /g, ",");
+          var menuFont = menuItem
+            .getAttribute("value")
+            .toLowerCase()
+            .replace(/, /g, ",");
 
           // First compare the entire font string to match items that contain commas.
           if (menuFont == editorFont) {
             menuItem.setAttribute("checked", "true");
             break;
-          } else if (editorFontOptions.length > 1) { // Next compare the individual options.
+          } else if (editorFontOptions.length > 1) {
+            // Next compare the individual options.
             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.
-              if (matchPos == 0)
+              if (matchPos == 0) {
                 break;
+              }
 
               matchedOption = matchPos;
               matchFound = true;
             }
           }
         }
 
         // In case this item doesn't match, make sure we've cleared the checkmark.
-        if (!matchFound)
+        if (!matchFound) {
           menuItem.removeAttribute("checked");
+        }
       }
     }
   }
 }
 
 // Number of fixed font face menuitems, these are:
 // Variable Width
 // Fixed Width
@@ -949,36 +1089,43 @@ function initFontFaceMenu(menuPopup) {
 // ==separator
 // ==separator
 const kFixedFontFaceMenuItems = 8;
 
 function initLocalFontFaceMenu(menuPopup) {
   if (!gLocalFonts) {
     // Build list of all local fonts once per editor
     try {
-      var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
-                         .getService(Ci.nsIFontEnumerator);
+      var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"].getService(
+        Ci.nsIFontEnumerator
+      );
       gLocalFonts = enumerator.EnumerateAllFonts();
     } catch (e) {}
   }
 
   // Don't use radios for menulists.
-  let useRadioMenuitems = (menuPopup.parentNode.localName == "menu");
+  let useRadioMenuitems = menuPopup.parentNode.localName == "menu";
   menuPopup.setAttribute("useRadios", useRadioMenuitems);
   if (menuPopup.childNodes.length == kFixedFontFaceMenuItems) {
     if (gLocalFonts.length == 0) {
       menuPopup.querySelector(".fontFaceMenuAfterDefaultFonts").hidden = true;
     }
     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") {
-        let itemNode = createFontFaceMenuitem(gLocalFonts[i], gLocalFonts[i], menuPopup);
+      if (
+        gLocalFonts[i] != "" &&
+        gLocalFonts[i] != "serif" &&
+        gLocalFonts[i] != "sans-serif" &&
+        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
@@ -988,47 +1135,59 @@ function initLocalFontFaceMenu(menuPopup
  * @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) {
   let itemNode = document.createXULElement("menuitem");
   itemNode.setAttribute("label", aFontLabel);
   itemNode.setAttribute("value", aFontName);
-  itemNode.setAttribute("value_parsed", aFontName.toLowerCase().replace(/, /g, ","));
+  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() {
   var firstHas = { value: false };
   var anyHas = { value: false };
   var allHas = { value: false };
 
-  var fontSize = EditorGetTextProperty("font", "size", null, firstHas, anyHas, allHas);
+  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
   // CSS sizes are not recognised and will show as "medium" as well.
   // Currently we can't distinguish between "no attribute" which
   // can imply "medium" and "CSS attribute present" which should not
   // imply "medium".
-  if (!anyHas.value)
+  if (!anyHas.value) {
     return 2;
+  }
 
   // Mixed selection.
-  if (!allHas.value)
+  if (!allHas.value) {
     return -1;
+  }
 
   switch (fontSize) {
     case "-3":
     case "-2":
     case "0":
     case "1":
       // x-small.
       return 0;
@@ -1057,18 +1216,19 @@ function getFontSizeIndex() {
 
   // We shouldn't get here. All the selection has a value we don't understand.
   return -1;
 }
 
 function initFontSizeMenu(menuPopup, fullMenu) {
   if (menuPopup) {
     var children = menuPopup.childNodes;
-    if (!children)
+    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) {
       children[menuIndex + setIndex].setAttribute("checked", true);
@@ -1076,168 +1236,193 @@ function initFontSizeMenu(menuPopup, ful
       // 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.
-    if (!menuPopup.lastChild.id.includes("smallBigInfo"))
+    if (!menuPopup.lastChild.id.includes("smallBigInfo")) {
       return;
+    }
 
     // While it would be better to show the number of levels,
     // at least this tells user if either of them are set.
     var firstHas = { value: false };
     var anyHas = { value: false };
     var allHas = { value: false };
 
     // Show "small"/"big" indicator.
     var htmlInfo = "";
     EditorGetTextProperty("small", "", "", firstHas, anyHas, allHas);
-    if (anyHas.value)
+    if (anyHas.value) {
       htmlInfo = "<small>";
+    }
     EditorGetTextProperty("big", "", "", firstHas, anyHas, allHas);
-    if (anyHas.value)
+    if (anyHas.value) {
       htmlInfo += "<big>";
+    }
 
     if (htmlInfo) {
       menuPopup.lastChild.hidden = false;
       menuPopup.lastChild.setAttribute("label", "HTML: " + htmlInfo);
       menuPopup.lastChild.setAttribute("checked", true);
     } else {
       menuPopup.lastChild.hidden = true;
     }
   }
 }
 
 function onHighlightColorChange() {
-  ChangeButtonColor("cmd_highlight", "HighlightColorButton",
-                    "transparent");
+  ChangeButtonColor("cmd_highlight", "HighlightColorButton", "transparent");
 }
 
 function onFontColorChange() {
-  ChangeButtonColor("cmd_fontColor", "TextColorButton",
-                    gDefaultTextColor);
+  ChangeButtonColor("cmd_fontColor", "TextColorButton", gDefaultTextColor);
 }
 
 function onBackgroundColorChange() {
-  ChangeButtonColor("cmd_backgroundColor", "BackgroundColorButton",
-                    gDefaultBackgroundColor);
+  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) {
     var color = commandNode.getAttribute("state");
     var button = document.getElementById(id);
     if (button) {
       button.setAttribute("color", color);
 
       // No color or a mixed color - get color set on page or other defaults.
-      if (!color || color == "mixed")
+      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() {
   var BrowserColors = GetDefaultBrowserColors();
   var bodyelement = GetBodyElement();
   var defTextColor = gDefaultTextColor;
   var defBackColor = gDefaultBackgroundColor;
 
   if (bodyelement) {
     var color = bodyelement.getAttribute("text");
-    if (color)
+    if (color) {
       gDefaultTextColor = color;
-    else if (BrowserColors)
+    } else if (BrowserColors) {
       gDefaultTextColor = BrowserColors.TextColor;
+    }
 
     color = bodyelement.getAttribute("bgcolor");
-    if (color)
+    if (color) {
       gDefaultBackgroundColor = color;
-    else if (BrowserColors)
+    } else if (BrowserColors) {
       gDefaultBackgroundColor = BrowserColors.BackgroundColor;
+    }
   }
 
   // Trigger update on toolbar
   if (defTextColor != gDefaultTextColor) {
     goUpdateCommandState("cmd_fontColor");
     onFontColorChange();
   }
   if (defBackColor != gDefaultBackgroundColor) {
     goUpdateCommandState("cmd_backgroundColor");
     onBackgroundColorChange();
   }
 }
 
 function GetBackgroundElementWithColor() {
   var editor = GetCurrentTableEditor();
-  if (!editor)
+  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});
+    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);
+    gColorObj.BackgroundColor = GetHTMLOrCSSStyleValue(
+      element,
+      "bgcolor",
+      "background-color"
+    );
+    gColorObj.BackgroundColor = ConvertRGBColorIntoHEXColor(
+      gColorObj.BackgroundColor
+    );
     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 = GetHTMLOrCSSStyleValue(
+        table,
+        "bgcolor",
+        "background-color"
+      );
       gColorObj.TableColor = ConvertRGBColorIntoHEXColor(gColorObj.TableColor);
     } else {
       gColorObj.Type = "Table";
       gColorObj.TableColor = gColorObj.BackgroundColor;
     }
     gColorObj.SelectedType = gColorObj.Type;
   } else {
     let IsCSSPrefChecked = Services.prefs.getBoolPref(kUseCssPref);
     if (IsCSSPrefChecked && IsHTMLEditor()) {
       let selection = editor.selection;
       if (selection) {
         element = selection.focusNode;
-        while (!editor.nodeIsBlock(element))
+        while (!editor.nodeIsBlock(element)) {
           element = element.parentNode;
+        }
       } else {
         element = GetBodyElement();
       }
     } else {
       element = GetBodyElement();
     }
     if (element) {
       gColorObj.Type = "Page";
-      gColorObj.BackgroundColor = GetHTMLOrCSSStyleValue(element, "bgcolor", "background-color");
+      gColorObj.BackgroundColor = GetHTMLOrCSSStyleValue(
+        element,
+        "bgcolor",
+        "background-color"
+      );
       if (gColorObj.BackgroundColor == "") {
         gColorObj.BackgroundColor = "transparent";
       } else {
-        gColorObj.BackgroundColor = ConvertRGBColorIntoHEXColor(gColorObj.BackgroundColor);
+        gColorObj.BackgroundColor = ConvertRGBColorIntoHEXColor(
+          gColorObj.BackgroundColor
+        );
       }
       gColorObj.PageColor = gColorObj.BackgroundColor;
     }
   }
   return element;
 }
 
 function SetSmiley(smileyText) {
@@ -1245,163 +1430,206 @@ function SetSmiley(smileyText) {
     GetCurrentEditor().insertText(smileyText);
     gContentWindow.focus();
   } catch (e) {}
 }
 
 /* eslint-disable complexity */
 function EditorSelectColor(colorType, mouseEvent) {
   var editor = GetCurrentEditor();
-  if (!editor || !gColorObj)
+  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)
+  if (!colorType) {
     colorType = "";
+  }
 
   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
+    } else {
       useLastColor = false;
+    }
   } 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
+    } else {
       useLastColor = false;
+    }
   } else {
     element = GetBackgroundElementWithColor();
-    if (!element)
+    if (!element) {
       return;
+    }
 
     // Get the table if we found a cell
-    if (gColorObj.Type == "Table")
+    if (gColorObj.Type == "Table") {
       table = element;
-    else if (gColorObj.Type == "Cell")
+    } else if (gColorObj.Type == "Cell") {
       table = GetParentTable(element);
+    }
 
     // Save to avoid resetting if not necessary
     currentColor = gColorObj.BackgroundColor;
 
     if (colorType == "TableOrCell" || colorType == "Cell") {
-      if (gColorObj.Type == "Cell")
+      if (gColorObj.Type == "Cell") {
         gColorObj.Type = colorType;
-      else if (gColorObj.Type != "Table")
+      } else if (gColorObj.Type != "Table") {
         return;
+      }
     } else if (colorType == "Table" && gColorObj.Type == "Page") {
       return;
     }
 
     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
+    } else {
       useLastColor = false;
+    }
   }
   // Save the type we are really requesting
   colorType = gColorObj.Type;
 
   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);
+    window.openDialog(
+      "chrome://editor/content/EdColorPicker.xul",
+      "_blank",
+      "chrome,close,titlebar,modal",
+      "",
+      gColorObj
+    );
 
     // User canceled the dialog
-    if (gColorObj.Cancel)
+    if (gColorObj.Cancel) {
       return;
+    }
   }
 
   if (gColorObj.Type == "Text") {
     if (currentColor != gColorObj.TextColor) {
-      if (gColorObj.TextColor)
+      if (gColorObj.TextColor) {
         EditorSetTextProperty("font", "color", gColorObj.TextColor);
-      else
+      } 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) {
-      if (gColorObj.HighlightColor)
+      if (gColorObj.HighlightColor) {
         EditorSetTextProperty("font", "bgcolor", gColorObj.HighlightColor);
-      else
+      } else {
         EditorRemoveTextProperty("font", "bgcolor");
+      }
     }
     // Update the command state (this will trigger color button update)
     goUpdateCommandState("cmd_highlight");
   } 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) {
         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) {}
+        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()) {
       editor.beginTransaction();
       try {
         editor.setBackgroundColor(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) {
             var defColors = GetDefaultBrowserColors();
             if (defColors) {
-              if (!bodyelement.getAttribute("text"))
-                editor.setAttributeOrEquivalent(bodyelement, "text", defColors.TextColor, false);
+              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"))
+              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);
+              }
+
+              if (!bodyelement.getAttribute("alink")) {
+                editor.setAttribute(
+                  bodyelement,
+                  "alink",
+                  defColors.ActiveLinkColor
+                );
+              }
+
+              if (!bodyelement.getAttribute("vlink")) {
+                editor.setAttribute(
+                  bodyelement,
+                  "vlink",
+                  defColors.VisitedLinkColor
+                );
+              }
             }
           }
         }
       } catch (e) {}
 
       editor.endTransaction();
     }
 
@@ -1409,57 +1637,76 @@ function EditorSelectColor(colorType, mo
   }
   gContentWindow.focus();
 }
 /* eslint-enable complexity */
 
 function GetParentTable(element) {
   var node = element;
   while (node) {
-    if (node.nodeName.toLowerCase() == "table")
+    if (node.nodeName.toLowerCase() == "table") {
       return node;
+    }
 
     node = node.parentNode;
   }
   return node;
 }
 
 function GetParentTableCell(element) {
   var node = element;
   while (node) {
-    if (node.nodeName.toLowerCase() == "td" || node.nodeName.toLowerCase() == "th")
+    if (
+      node.nodeName.toLowerCase() == "td" ||
+      node.nodeName.toLowerCase() == "th"
+    ) {
       return node;
+    }
 
     node = node.parentNode;
   }
   return node;
 }
 
 function EditorDblClick(event) {
   // We check event.explicitOriginalTarget here because .target will never
   // be a textnode (bug 193689)
   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)
+    //  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())) {
+    if (
+      element &&
+      ![
+        "body",
+        "p",
+        "h1",
+        "h2",
+        "h3",
+        "h4",
+        "h5",
+        "h6",
+        "blockquote",
+        "div",
+        "pre",
+      ].includes(element.nodeName.toLowerCase())
+    ) {
       goDoCommand("cmd_objectProperties");
       event.preventDefault();
     }
   }
 }
 
 function EditorClick(event) {
   // For Web Composer: In Show All Tags Mode,
@@ -1482,18 +1729,19 @@ function EditorClick(event) {
 /* 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() {
   var editor = GetCurrentEditor();
-  if (!editor || !IsHTMLEditor())
+  if (!editor || !IsHTMLEditor()) {
     return null;
+  }
 
   var element;
   try {
     element = editor.getSelectedElement("");
   } catch (e) {}
   if (element) {
     if (element.namespaceURI == "http://www.w3.org/1998/Math/MathML") {
       // If the object is a MathML element, we collapse the selection on it and
@@ -1513,114 +1761,140 @@ function GetObjectForProperties() {
     anchorNode = editor.selection.anchorNode;
     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)
+    if (!node) {
       node = anchorNode;
+    }
   } catch (e) {}
 
   while (node) {
     if (node.nodeName) {
       var nodeName = node.nodeName.toLowerCase();
 
       // Done when we hit the body or #text.
       if (nodeName == "body" || nodeName == "#text") {
         break;
       }
 
-      if ((nodeName == "a" && node.href) ||
-          nodeName == "ol" || nodeName == "ul" || nodeName == "dl" ||
-          nodeName == "td" || nodeName == "th" ||
-          nodeName == "table" || nodeName == "math") {
+      if (
+        (nodeName == "a" && node.href) ||
+        nodeName == "ol" ||
+        nodeName == "ul" ||
+        nodeName == "dl" ||
+        nodeName == "td" ||
+        nodeName == "th" ||
+        nodeName == "table" ||
+        nodeName == "math"
+      ) {
         return node;
       }
     }
     node = node.parentNode;
   }
   return null;
 }
 
 function SetEditMode(mode) {
-  if (!IsHTMLEditor())
+  if (!IsHTMLEditor()) {
     return;
+  }
 
   var bodyElement = GetBodyElement();
   if (!bodyElement) {
     dump("SetEditMode: We don't have a body node!\n");
     return;
   }
 
   // must have editor if here!
   var editor = GetCurrentEditor();
   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))
+  if (!SetDisplayMode(mode)) {
     return;
+  }
 
   if (mode == kDisplayModeSource) {
     // Display the DOCTYPE as a non-editable string above edit area
     var domdoc;
     try {
       domdoc = editor.document;
     } catch (e) {
       dump(e + "\n");
     }
     if (domdoc) {
       var doctypeNode = document.getElementById("doctype-text");
       var dt = domdoc.doctype;
       if (doctypeNode) {
         if (dt) {
           doctypeNode.collapsed = false;
           var doctypeText = "<!DOCTYPE " + domdoc.doctype.name;
-          if (dt.publicId)
-            doctypeText += " PUBLIC \"" + domdoc.doctype.publicId;
-          if (dt.systemId)
-            doctypeText += " \"" + dt.systemId;
-          doctypeText += "\">";
+          if (dt.publicId) {
+            doctypeText += ' PUBLIC "' + domdoc.doctype.publicId;
+          }
+          if (dt.systemId) {
+            doctypeText += ' "' + dt.systemId;
+          }
+          doctypeText += '">';
           doctypeNode.setAttribute("value", doctypeText);
         } else {
           doctypeNode.collapsed = true;
         }
       }
     }
     // Get the entire document's source string
 
-    var flags = (editor.documentCharacterSet == "ISO-8859-1")
-      ? kOutputEncodeLatin1Entities
-      : kOutputEncodeBasicEntities;
+    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 "latin1" : flags = kOutputEncodeLatin1Entities; break;
-        case "html" : flags = kOutputEncodeHTMLEntities; break;
-        case "none" : flags = 0; break;
+        case "basic":
+          flags = kOutputEncodeBasicEntities;
+          break;
+        case "latin1":
+          flags = kOutputEncodeLatin1Entities;
+          break;
+        case "html":
+          flags = kOutputEncodeHTMLEntities;
+          break;
+        case "none":
+          flags = 0;
+          break;
       }
     } catch (e) {}
 
-    if (Services.prefs.getBoolPref("editor.prettyprint"))
+    if (Services.prefs.getBoolPref("editor.prettyprint")) {
       flags |= kOutputFormatted;
+    }
 
     flags |= kOutputLFLineBreak;
     var source = editor.outputToString(editor.contentsMIMEType, flags);
     var start = source.search(/<html/i);
-    if (start == -1) start = 0;
+    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.commandManager.addCommandObserver(
+      gSourceTextObserver,
+      "cmd_undo"
+    );
     gSourceContentWindow.contentWindow.focus();
     goDoCommand("cmd_moveTop");
   } else if (previousMode == kDisplayModeSource) {
     // Only rebuild document if a change was made in source window
     if (IsHTMLSourceChanged()) {
       // Disable spell checking when rebuilding source
       InlineSpellCheckerUI.enabled = false;
       inlineSpellCheckItem.removeAttribute("checked");
@@ -1631,25 +1905,32 @@ function SetEditMode(mode) {
       try {
         editor.transactionManager.maxTransactionCount = 1;
       } catch (e) {}
 
       editor.beginTransaction();
       try {
         // We are coming from edit source mode,
         //   so transfer that back into the document
-        source = gSourceTextEditor.outputToString(kTextMimeType, kOutputLFLineBreak).trim();
+        source = gSourceTextEditor
+          .outputToString(kTextMimeType, kOutputLFLineBreak)
+          .trim();
         if (editor.contentsMIMEType != kXHTMLMimeType) {
           editor.rebuildDocumentFromSource(source);
         } else {
           /* eslint-disable-next-line no-unsanitized/method */
-          var fragment = editor.document.createRange().createContextualFragment(source);
+          var fragment = editor.document
+            .createRange()
+            .createContextualFragment(source);
           editor.enableUndo(false);
           GetBodyElement().remove();
-          editor.document.replaceChild(fragment.firstChild, editor.document.documentElement);
+          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) {
@@ -1659,57 +1940,67 @@ function SetEditMode(mode) {
 
       // Restore unlimited undo count
       try {
         editor.transactionManager.maxTransactionCount = -1;
       } catch (e) {}
     }
 
     // Clear out the string buffers
-    gSourceContentWindow.commandManager.removeCommandObserver(gSourceTextObserver, "cmd_undo");
+    gSourceContentWindow.commandManager.removeCommandObserver(
+      gSourceTextObserver,
+      "cmd_undo"
+    );
     gSourceTextEditor.removeDocumentStateListener(gSourceTextListener);
     gSourceTextEditor.enableUndo(false);
     gSourceTextEditor.selectAll();
-    gSourceTextEditor.deleteSelection(gSourceTextEditor.eNone,
-                                      gSourceTextEditor.eStrip);
+    gSourceTextEditor.deleteSelection(
+      gSourceTextEditor.eNone,
+      gSourceTextEditor.eStrip
+    );
     gSourceTextEditor.resetModificationCount();
 
     gContentWindow.focus();
     // goDoCommand("cmd_moveTop");
   }
 
   switch (mode) {
     case kDisplayModePreview:
       // Disable spell checking when previewing
       InlineSpellCheckerUI.enabled = false;
       inlineSpellCheckItem.removeAttribute("checked");
-      // fall through
+    // fall through
     case kDisplayModeSource:
       inlineSpellCheckItem.setAttribute("disabled", "true");
       break;
     default:
-      inlineSpellCheckItem.setAttribute("disabled", !InlineSpellCheckerUI.canSpellCheck);
+      inlineSpellCheckItem.setAttribute(
+        "disabled",
+        !InlineSpellCheckerUI.canSpellCheck
+      );
       break;
   }
 }
 
 function CancelHTMLSource() {
   // Don't convert source text back into the DOM document
   gSourceTextEditor.resetModificationCount();
   SetDisplayMode(gPreviousNonSourceDisplayMode);
 }
 
 function SetDisplayMode(mode) {
-  if (!IsHTMLEditor())
+  if (!IsHTMLEditor()) {
     return false;
+  }
 
   // Already in requested mode:
   //  return false to indicate we didn't switch
-  if (mode == gEditorDisplayMode)
+  if (mode == gEditorDisplayMode) {
     return false;
+  }
 
   var previousMode = gEditorDisplayMode;
   gEditorDisplayMode = mode;
 
   ResetStructToolbar();
   if (mode == kDisplayModeSource) {
     // Switch to the sourceWindow (second in the deck)
     gContentWindowDeck.selectedIndex = 1;
@@ -1768,53 +2059,61 @@ function SetDisplayMode(mode) {
     gContentWindow.focus();
   }
 
   // update commands to disable or re-enable stuff
   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]);
+  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");
-
+  if (previousMode >= 0) {
+    document
+      .getElementById(kDisplayModeMenuIDs[previousMode])
+      .setAttribute("checked", "false");
+  }
+  document
+    .getElementById(kDisplayModeMenuIDs[mode])
+    .setAttribute("checked", "true");
 
   return true;
 }
 
 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)) {
       var scheme = GetScheme(docUrl);
       filename = GetFilename(docUrl);
-      if (filename)
+      if (filename) {
         windowTitle = " [" + scheme + ":/.../" + filename + "]";
+      }
 
       var fileType = IsHTMLEditor() ? "html" : "text";
       // Save changed title in the recent pages data in prefs
       SaveRecentFilesPrefs(title, fileType);
     }
 
     // Set window title with " - Composer" or " - Text Editor" appended.
     var xulWin = document.documentElement;
 
-    document.title = (title || filename || window.gUntitledString) +
-                     windowTitle +
-                     xulWin.getAttribute("titlemenuseparator") +
-                     xulWin.getAttribute("titlemodifier");
+    document.title =
+      (title || filename || window.gUntitledString) +
+      windowTitle +
+      xulWin.getAttribute("titlemenuseparator") +
+      xulWin.getAttribute("titlemodifier");
   } catch (e) {
     dump(e);
   }
 }
 
 function SaveRecentFilesPrefs(aTitle, aFileType) {
   var curUrl = StripPassword(GetDocumentUrl());
   var historyCount = Services.prefs.getIntPref("editor.history.url_maximum");
@@ -1833,17 +2132,20 @@ function SaveRecentFilesPrefs(aTitle, aF
     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") {
       let title = Services.prefs.getStringPref("editor.history_title_" + i, "");
-      let fileType = Services.prefs.getStringPref("editor.history_type_" + 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++) {
@@ -1851,34 +2153,40 @@ function SaveRecentFilesPrefs(aTitle, aF
     SetStringPref("editor.history_url_" + i, urlArray[i]);
     SetStringPref("editor.history_type_" + i, typeArray[i]);
   }
 }
 
 function EditorInitFormatMenu() {
   try {
     InitObjectPropertiesMenuitem();
-    InitRemoveStylesMenuitems("removeStylesMenuitem", "removeLinksMenuitem", "removeNamedAnchorsMenuitem");
+    InitRemoveStylesMenuitems(
+      "removeStylesMenuitem",
+      "removeLinksMenuitem",
+      "removeNamedAnchorsMenuitem"
+    );
   } catch (ex) {}
 }
 
 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)
+  if (!cmd) {
     return null;
+  }
 
   var element;
   var menuStr = GetString("AdvancedProperties");
   var name;
 
-  if (IsEditingRenderedHTML())
+  if (IsEditingRenderedHTML()) {
     element = GetObjectForProperties();
+  }
 
   if (element && element.nodeName) {
     var objStr = "";
     cmd.removeAttribute("disabled");
     name = element.nodeName.toLowerCase();
     switch (name) {
       case "img":
         // Check if img is enclosed in link
@@ -1886,48 +2194,50 @@ function InitObjectPropertiesMenuitem() 
         try {
           if (GetCurrentEditor().getElementOrParentByTagName("href", element)) {
             objStr = GetString("ImageAndLink");
             // Return "href" so it is detected as a link.
             name = "href";
           }
         } catch (e) {}
 
-        if (objStr == "")
+        if (objStr == "") {
           objStr = GetString("Image");
+        }
         break;
       case "hr":
         objStr = GetString("HLine");
         break;
       case "table":
         objStr = GetString("Table");
         break;
       case "th":
         name = "td";
-        // Falls through
+      // Falls through
       case "td":
         objStr = GetString("TableCell");
         break;
       case "ol":
       case "ul":
       case "dl":
         objStr = GetString("List");
         break;
       case "li":
         objStr = GetString("ListItem");
         break;
       case "form":
         objStr = GetString("Form");
         break;
       case "input":
         var type = element.getAttribute("type");
-        if (type && type.toLowerCase() == "image")
+        if (type && type.toLowerCase() == "image") {
           objStr = GetString("InputImage");
-        else
+        } else {
           objStr = GetString("InputTag");
+        }
         break;
       case "textarea":
         objStr = GetString("TextArea");
         break;
       case "select":
         objStr = GetString("Select");
         break;
       case "button":
@@ -1944,18 +2254,19 @@ function InitObjectPropertiesMenuitem() 
           objStr = GetString("NamedAnchor");
           name = "anchor";
         } else if (element.href) {
           objStr = GetString("Link");
           name = "href";
         }
         break;
     }
-    if (objStr)
+    if (objStr) {
       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;
 }
@@ -1967,115 +2278,134 @@ function InitParagraphMenu() {
     state = GetCurrentEditor().getParagraphState(mixedObj);
   } 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
-  else
+  if (!state || state == "x") {
+    IDSuffix = "bodyText";
+  } // No paragraph container
+  else {
     IDSuffix = state;
+  }
 
   // Set "radio" check on one item, but...
   var menuItem = document.getElementById("menu_" + IDSuffix);
   menuItem.setAttribute("checked", "true");
 
   // ..."bodyText" is returned if mixed selection, so remove checkmark
-  if (mixedObj.value)
+  if (mixedObj.value) {
     menuItem.setAttribute("checked", "false");
+  }
 }
 
 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)
+    if (mixedObj.value) {
       return "mixed";
-    if (hasOL.value)
+    }
+    if (hasOL.value) {
       return "ol";
-    if (hasUL.value)
+    }
+    if (hasUL.value) {
       return "ul";
+    }
 
     if (hasDL.value) {
       var hasLI = { value: false };
       var hasDT = { value: false };
       var hasDD = { value: false };
       editor.getListItemState(mixedObj, hasLI, hasDT, hasDD);
-      if (mixedObj.value)
+      if (mixedObj.value) {
         return "mixed";
-      if (hasLI.value)
+      }
+      if (hasLI.value) {
         return "li";
-      if (hasDT.value)
+      }
+      if (hasDT.value) {
         return "dt";
-      if (hasDD.value)
+      }
+      if (hasDD.value) {
         return "dd";
+      }
     }
   } catch (e) {}
 
   // return "noList" if we aren't in a list at all
   return "noList";
 }
 
 function InitListMenu() {
-  if (!IsHTMLEditor())
+  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);
-  if (menuItem)
+  if (menuItem) {
     menuItem.setAttribute("checked", "true");
+  }
 }
 
 function GetAlignmentString() {
   var mixedObj = { value: null };
   var alignObj = { value: null };
   try {
     GetCurrentEditor().getAlignment(mixedObj, alignObj);
   } catch (e) {}
 
-  if (mixedObj.value)
+  if (mixedObj.value) {
     return "mixed";
-  if (alignObj.value == nsIHTMLEditor.eLeft)
+  }
+  if (alignObj.value == nsIHTMLEditor.eLeft) {
     return "left";
-  if (alignObj.value == nsIHTMLEditor.eCenter)
+  }
+  if (alignObj.value == nsIHTMLEditor.eCenter) {
     return "center";
-  if (alignObj.value == nsIHTMLEditor.eRight)
+  }
+  if (alignObj.value == nsIHTMLEditor.eRight) {
     return "right";
-  if (alignObj.value == nsIHTMLEditor.eJustify)
+  }
+  if (alignObj.value == nsIHTMLEditor.eJustify) {
     return "justify";
+  }
 
   // return "left" if we got here
   return "left";
 }
 
 function InitAlignMenu() {
-  if (!IsHTMLEditor())
+  if (!IsHTMLEditor()) {
     return;
+  }
 
   var IDSuffix = GetAlignmentString();
 
   // we won't find a match if it's "mixed"
   var menuItem = document.getElementById("menu_" + IDSuffix);
-  if (menuItem)
+  if (menuItem) {
     menuItem.setAttribute("checked", "true");
+  }
 }
 
 function EditorSetDefaultPrefsAndDoctype() {
   var editor = GetCurrentEditor();
 
   var domdoc;
   try {
     domdoc = editor.document;
@@ -2085,94 +2415,134 @@ function EditorSetDefaultPrefsAndDoctype
   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 (newdoctype)
+    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) {
     headelement = domdoc.createElement("head");
-    if (headelement)
+    if (headelement) {
       domdoc.insertAfter(headelement, domdoc.firstChild);
+    }
   }
 
   /* only set default prefs for new documents */
-  if (!IsUrlAboutBlank(GetDocumentUrl()))
+  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")) {
     // 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)
+    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 {
       prefAuthorString = Services.prefs.getStringPref("editor.author");
     } catch (ex) {}
-    if (prefAuthorString && prefAuthorString != 0 && !authorFound && headelement) {
+    if (
+      prefAuthorString &&
+      prefAuthorString != 0 &&
+      !authorFound &&
+      headelement
+    ) {
       // create meta tag with 2 attributes
       element = domdoc.createElement("meta");
       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")) {
-     var titleElement = domdoc.createElement("title");
-     if (titleElement)
-       headelement.appendChild(titleElement);
+    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")) {
       let text_color = Services.prefs.getCharPref("editor.text_color");
-      let background_color = Services.prefs.getCharPref("editor.background_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);
+      editor.setAttributeOrEquivalent(
+        bodyelement,
+        "bgcolor",
+        background_color,
+        true
+      );
       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"));
+      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);
+      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");
     }
   }
   // auto-save???
 }
 
 function GetBodyElement() {
@@ -2187,42 +2557,43 @@ function GetBodyElement() {
 
 // --------------------------- Logging stuff ---------------------------
 
 function EditorGetNodeFromOffsets(offsets) {
   var node = null;
   try {
     node = GetCurrentEditor().document;
 
-    for (var i = 0; i < offsets.length; i++)
+    for (var i = 0; i < offsets.length; i++) {
       node = node.childNodes[offsets[i]];
+    }
   } catch (e) {}
   return node;
 }
 
 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++) {
       rangeArr = selRanges[i];
-      start    = rangeArr[0];
-      end      = rangeArr[1];
+      start = rangeArr[0];
+      end = rangeArr[1];
 
       var range = editor.document.createRange();
 
-      node   = EditorGetNodeFromOffsets(start[0]);
+      node = EditorGetNodeFromOffsets(start[0]);
       offset = start[1];
 
       range.setStart(node, offset);
 
-      node   = EditorGetNodeFromOffsets(end[0]);
+      node = EditorGetNodeFromOffsets(end[0]);
       offset = end[1];
 
       range.setEnd(node, offset);
 
       selection.addRange(range);
     }
   } catch (e) {}
 }
@@ -2251,58 +2622,61 @@ function onStateButtonUpdate(button, com
   var state = commandNode.getAttribute("state");
 
   button.checked = state == onState;
 }
 
 // --------------------------- Status calls ---------------------------
 function getColorAndSetColorWell(ColorPickerID, ColorWellID) {
   var colorWell;
-  if (ColorWellID)
+  if (ColorWellID) {
     colorWell = document.getElementById(ColorWellID);
+  }
 
   var colorPicker = document.getElementById(ColorPickerID);
   if (colorPicker) {
     // Extract color from colorPicker and assign to colorWell.
     var color = colorPicker.getAttribute("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() {
-  return true;  // Always installed.
+  return true; // Always installed.
 }
 
 // -----------------------------------------------------------------------------------
 function IsFindInstalled() {
-  return "@mozilla.org/embedcomp/rangefind;1" in Cc
-          && "@mozilla.org/find/find_service;1" in Cc;
+  return (
+    "@mozilla.org/embedcomp/rangefind;1" in Cc &&
+    "@mozilla.org/find/find_service;1" in Cc
+  );
 }
 
 // -----------------------------------------------------------------------------------
 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 no find, remove find ui
   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 no spell checker, remove spell checker ui
   if (!IsSpellCheckerInstalled()) {
     HideItem("spellingButton");
     HideItem("menu_checkspelling");
     RemoveItem("sep_checkspelling");
   }
 
   // Remove menu items (from overlay shared with HTML editor) in non-HTML.
   if (!IsHTMLEditor()) {
@@ -2315,24 +2689,26 @@ function RemoveInapplicableUIElements() 
     HideItem("fileExportToText");
     HideItem("viewFormatToolbar");
     HideItem("viewEditModeToolbar");
   }
 }
 
 function HideItem(id) {
   var item = document.getElementById(id);
-  if (item)
+  if (item) {
     item.hidden = true;
+  }
 }
 
 function RemoveItem(id) {
   var item = document.getElementById(id);
-  if (item)
+  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() {
   try {
     InitJoinCellMenuitem("menu_JoinTableCells");
@@ -2345,61 +2721,83 @@ function EditorInitTableMenu() {
 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;
+  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};
-    foundElement = GetCurrentTableEditor().getSelectedOrParentTableElement(tagNameObj, countObj);
+    var countObj = { value: 0 };
+    foundElement = GetCurrentTableEditor().getSelectedOrParentTableElement(
+      tagNameObj,
+      countObj
+    );
     numSelected = countObj.value;
   } catch (e) {}
-  if (foundElement && numSelected > 1)
+  if (foundElement && numSelected > 1) {
     menuText = GetString("JoinSelectedCells");
-  else
+  } else {
     menuText = GetString("JoinCellToRight");
+  }
 
   menuItem.setAttribute("label", menuText);
   menuItem.setAttribute("accesskey", GetString("JoinCellAccesskey"));
 }
 
-function InitRemoveStylesMenuitems(removeStylesId, removeLinksId, removeNamedAnchorsId) {
+function InitRemoveStylesMenuitems(
+  removeStylesId,
+  removeLinksId,
+  removeNamedAnchorsId
+) {
   var editor = GetCurrentEditor();
-  if (!editor)
+  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) {
-    stylesItem.setAttribute("label", isCollapsed ? GetString("StopTextStyles") : GetString("RemoveTextStyles"));
-    stylesItem.setAttribute("accesskey", GetString("RemoveTextStylesAccesskey"));
+    stylesItem.setAttribute(
+      "label",
+      isCollapsed ? GetString("StopTextStyles") : GetString("RemoveTextStyles")
+    );
+    stylesItem.setAttribute(
+      "accesskey",
+      GetString("RemoveTextStylesAccesskey")
+    );
   }
   if (linkItem) {
-    linkItem.setAttribute("label", isCollapsed ? GetString("StopLinks") : GetString("RemoveLinks"));
+    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));
+      SetElementEnabled(
+        linkItem,
+        !isCollapsed || editor.getElementOrParentByTagName("href", null)
+      );
     } catch (e) {}
   }
   // Disable if selection is collapsed
   SetElementEnabledById(removeNamedAnchorsId, !isCollapsed);
 }
 
 function goUpdateTableMenuItems(commandset) {
   var editor = GetCurrentTableEditor();
@@ -2407,228 +2805,279 @@ function goUpdateTableMenuItems(commands
     dump("goUpdateTableMenuItems: too early, not initialized\n");
     return;
   }
 
   var enabled = false;
   var enabledIfTable = false;
 
   var flags = editor.flags;
-  if (!(flags & nsIPlaintextEditor.eEditorReadonlyMask) &&
-      IsEditingRenderedHTML()) {
+  if (
+    !(flags & nsIPlaintextEditor.eEditorReadonlyMask) &&
+    IsEditingRenderedHTML()
+  ) {
     var tagNameObj = { value: "" };
     var element;
     try {
-      element = editor.getSelectedOrParentTableElement(tagNameObj, {value: 0});
+      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");
+      enabled = tagNameObj.value == "td";
     }
   }
 
   // Loop through command nodes
   for (var i = 0; i < commandset.childNodes.length; i++) {
     var commandID = commandset.childNodes[i].getAttribute("id");
     if (commandID) {
-      if (commandID == "cmd_InsertTable" ||
-          commandID == "cmd_JoinTableCells" ||
-          commandID == "cmd_SplitTableCell" ||
-          commandID == "cmd_ConvertToTable") {
+      if (
+        commandID == "cmd_InsertTable" ||
+        commandID == "cmd_JoinTableCells" ||
+        commandID == "cmd_SplitTableCell" ||
+        commandID == "cmd_ConvertToTable"
+      ) {
         // Call the update method in the command class
         goUpdateCommand(commandID);
-      } else if (commandID == "cmd_DeleteTable" ||
-                 commandID == "cmd_NormalizeTable" ||
-                 commandID == "cmd_editTable" ||
-                 commandID == "cmd_TableOrCellColor" ||
-                 commandID == "cmd_SelectTable") { // Directly set with the values calculated here
+      } else if (
+        commandID == "cmd_DeleteTable" ||
+        commandID == "cmd_NormalizeTable" ||
+        commandID == "cmd_editTable" ||
+        commandID == "cmd_TableOrCellColor" ||
+        commandID == "cmd_SelectTable"
+      ) {
+        // Directly set with the values calculated here
         goSetCommandEnabled(commandID, enabledIfTable);
       } else {
         goSetCommandEnabled(commandID, enabled);
       }
     }
   }
 }
 
 // -----------------------------------------------------------------------------------
 // Helpers for inserting and editing tables:
 
 function IsInTable() {
   var editor = GetCurrentEditor();
   try {
     var flags = editor.flags;
-    return (IsHTMLEditor() &&
-            !(flags & nsIPlaintextEditor.eEditorReadonlyMask) &&
-            IsEditingRenderedHTML() &&
-            null != editor.getElementOrParentByTagName("table", null));
+    return (
+      IsHTMLEditor() &&
+      !(flags & nsIPlaintextEditor.eEditorReadonlyMask) &&
+      IsEditingRenderedHTML() &&
+      null != editor.getElementOrParentByTagName("table", null)
+    );
   } catch (e) {}
   return false;
 }
 
 function IsInTableCell() {
   try {
     var editor = GetCurrentEditor();
     var flags = editor.flags;
-    return (IsHTMLEditor() &&
-            !(flags & nsIPlaintextEditor.eEditorReadonlyMask) &&
-            IsEditingRenderedHTML() &&
-            null != editor.getElementOrParentByTagName("td", null));
+    return (
+      IsHTMLEditor() &&
+      !(flags & nsIPlaintextEditor.eEditorReadonlyMask) &&
+      IsEditingRenderedHTML() &&
+      null != editor.getElementOrParentByTagName("td", null)
+    );
   } catch (e) {}
   return false;
 }
 
 function IsSelectionInOneCell() {
   try {
     var editor = GetCurrentEditor();
     var selection = editor.selection;
 
     if (selection.rangeCount == 1) {
       // We have a "normal" single-range selection
-      if (!selection.isCollapsed &&
-         selection.anchorNode != selection.focusNode) {
+      if (
+        !selection.isCollapsed &&
+        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));
+        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()) {
     // 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) {
     try {
-      if (GetCurrentEditor().selection.isCollapsed)
+      if (GetCurrentEditor().selection.isCollapsed) {
         // If we have a caret, insert a blank table...
         EditorInsertTable();
-      else
-        // else convert the selection into a table
+      }
+      // else convert the selection into a table
+      else {
         goDoCommand("cmd_ConvertToTable");
+      }
     } catch (e) {}
   }
 }
 
 function EditorInsertTable() {
   // Insert a new table
-  window.openDialog("chrome://editor/content/EdInsertTable.xul", "_blank", "chrome,close,titlebar,modal", "");
+  window.openDialog(
+    "chrome://editor/content/EdInsertTable.xul",
+    "_blank",
+    "chrome,close,titlebar,modal",
+    ""
+  );
   gContentWindow.focus();
 }
 
 function EditorTableCellProperties() {
-  if (!IsHTMLEditor())
+  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");
+      window.openDialog(
+        "chrome://editor/content/EdTableProps.xul",
+        "_blank",
+        "chrome,close,titlebar,modal",
+        "",
+        "CellPanel"
+      );
       gContentWindow.focus();
     }
   } catch (e) {}
 }
 
 function GetNumberOfContiguousSelectedRows() {
-  if (!IsHTMLEditor())
+  if (!IsHTMLEditor()) {
     return 0;
+  }
 
   var rows = 0;
   try {
     var editor = GetCurrentTableEditor();
     var rowObj = { value: 0 };
     var colObj = { value: 0 };
     var cell = editor.getFirstSelectedCellInTable(rowObj, colObj);
-    if (!cell)
+    if (!cell) {
       return 0;
+    }
 
     // We have at least one row
     rows++;
 
     var lastIndex = rowObj.value;
     do {
-      cell = editor.getNextSelectedCell({value: 0});
+      cell = editor.getNextSelectedCell({ value: 0 });
       if (cell) {
         editor.getCellIndexes(cell, rowObj, colObj);
         var index = rowObj.value;
         if (index == lastIndex + 1) {
           lastIndex = index;
           rows++;
         }
       }
-    }
-    while (cell);
+    } while (cell);
   } catch (e) {}
 
   return rows;
 }
 
 function GetNumberOfContiguousSelectedColumns() {
-  if (!IsHTMLEditor())
+  if (!IsHTMLEditor()) {
     return 0;
+  }
 
   var columns = 0;
   try {
     var editor = GetCurrentTableEditor();
     var colObj = { value: 0 };
     var rowObj = { value: 0 };
     var cell = editor.getFirstSelectedCellInTable(rowObj, colObj);
-    if (!cell)
+    if (!cell) {
       return 0;
+    }
 
     // We have at least one column
     columns++;
 
     var lastIndex = colObj.value;
     do {
-      cell = editor.getNextSelectedCell({value: 0});
+      cell = editor.getNextSelectedCell({ value: 0 });
       if (cell) {
         editor.getCellIndexes(cell, rowObj, colObj);
         var index = colObj.value;
         if (index == lastIndex + 1) {
           lastIndex = index;
           columns++;
         }
       }
-    }
-    while (cell);
+    } while (cell);
   } catch (e) {}
 
   return columns;
 }
 
 function EditorOnFocus() {
   // Current window already has the InsertCharWindow
-  if ("InsertCharWindow" in window && window.InsertCharWindow) return;
+  if ("InsertCharWindow" in window && window.InsertCharWindow) {
+    return;
+  }
 
   // Find window with an InsertCharsWindow and switch association to this one
   var windowWithDialog = FindEditorWithInsertCharDialog();
   if (windowWithDialog) {
     // Switch the dialog to current window
     // this sets focus to dialog, so bring focus back to editor window
-    if (SwitchInsertCharToThisWindow(windowWithDialog))
+    if (SwitchInsertCharToThisWindow(windowWithDialog)) {
       top.document.commandDispatcher.focusedWindow.focus();
+    }
   }
 }
 
 function SwitchInsertCharToThisWindow(windowWithDialog) {
-  if (windowWithDialog && "InsertCharWindow" in windowWithDialog &&
-      windowWithDialog.InsertCharWindow) {
+  if (
+    windowWithDialog &&
+    "InsertCharWindow" in windowWithDialog &&
+    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
@@ -2641,18 +3090,22 @@ function SwitchInsertCharToThisWindow(wi
 function FindEditorWithInsertCharDialog() {
   try {
     // Find window with an InsertCharsWindow and switch association to this one
     let enumerator = Services.wm.getEnumerator(null);
 
     while (enumerator.hasMoreElements()) {
       var tempWindow = enumerator.getNext();
 
-      if (!tempWindow.closed && tempWindow != window &&
-          "InsertCharWindow" in tempWindow && tempWindow.InsertCharWindow) {
+      if (
+        !tempWindow.closed &&
+        tempWindow != window &&
+        "InsertCharWindow" in tempWindow &&
+        tempWindow.InsertCharWindow
+      ) {
         return tempWindow;
       }
     }
   } catch (e) {}
   return null;
 }
 
 function EditorFindOrCreateInsertCharWindow() {
@@ -2661,38 +3114,49 @@ function EditorFindOrCreateInsertCharWin
   } 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) {
       SwitchInsertCharToThisWindow(windowWithDialog);
     } else {
       // The dialog will set window.InsertCharWindow to itself
-      window.openDialog("chrome://editor/content/EdInsertChars.xul", "_blank", "chrome,close,titlebar", "");
+      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) {
     var enumerator;
     try {
       enumerator = Services.wm.getEnumerator(null);
     } catch (e) {}
-    if (!enumerator) return;
+    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();
-      if (!tempWindow.closed && tempWindow != window &&
-          tempWindow != window.InsertCharWindow &&
-          "GetCurrentEditor" in tempWindow && tempWindow.GetCurrentEditor()) {
+      if (
+        !tempWindow.closed &&
+        tempWindow != window &&
+        tempWindow != window.InsertCharWindow &&
+        "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();
@@ -2700,44 +3164,59 @@ function SwitchInsertCharToAnotherEditor
 }
 
 function ResetStructToolbar() {
   gLastFocusNode = null;
   UpdateStructToolbar();
 }
 
 function newCommandListener(element) {
-  return function() { return SelectFocusNodeAncestor(element); };
+  return function() {
+    return SelectFocusNodeAncestor(element);
+  };
 }
 
 function newContextmenuListener(button, element) {
-  /* globals InitStructBarContextMenu */// SeaMonkey only.
-  return function() { return InitStructBarContextMenu(button, element); };
+  /* globals InitStructBarContextMenu */ // SeaMonkey only.
+  return function() {
+    return InitStructBarContextMenu(button, element);
+  };
 }
 
 function UpdateStructToolbar() {
   var editor = GetCurrentEditor();
-  if (!editor) return;
+  if (!editor) {
+    return;
+  }
 
   var mixed = GetSelectionContainer();
-  if (!mixed) return;
+  if (!mixed) {
+    return;
+  }
   var element = mixed.node;
   var oneElementSelected = mixed.oneElementSelected;
 
-  if (!element) return;
-
-  if (element == gLastFocusNode &&
-      oneElementSelected == gLastFocusNodeWasSelected)
+  if (!element) {
     return;
+  }
+
+  if (
+    element == gLastFocusNode &&
+    oneElementSelected == gLastFocusNodeWasSelected
+  ) {
+    return;
+  }
 
   gLastFocusNode = element;
   gLastFocusNodeWasSelected = mixed.oneElementSelected;
 
   var toolbar = document.getElementById("structToolbar");
-  if (!toolbar) return;
+  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()) {
@@ -2759,47 +3238,55 @@ function UpdateStructToolbar() {
     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));
+    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) {
   var editor = GetCurrentEditor();
   if (editor) {
-    if (element == GetBodyElement())
+    if (element == GetBodyElement()) {
       editor.selectAll();
-    else
+    } else {
       editor.selectElement(element);
+    }
   }
   ResetStructToolbar();
 }
 
 function GetSelectionContainer() {
   var editor = GetCurrentEditor();
-  if (!editor) return null;
+  if (!editor) {
+    return null;
+  }
 
   var selection;
   try {
     selection = editor.selection;
-    if (!selection) return null;
+    if (!selection) {
+      return null;
+    }
   } catch (e) {
     return null;
   }
 
   var result = { oneElementSelected: false };
 
   if (selection.isCollapsed) {
     result.node = selection.focusNode;
@@ -2809,59 +3296,67 @@ function GetSelectionContainer() {
       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
       // last char of the style. Assume the style element is selected for
       // user's pleasure
-      if (!result.node &&
-          range.startContainer.nodeType == Node.TEXT_NODE &&
-          range.startOffset == range.startContainer.length &&
-          range.endContainer.nodeType == Node.TEXT_NODE &&
-          range.endOffset == range.endContainer.length &&
-          range.endContainer.nextSibling == null &&
-          range.startContainer.nextSibling == range.endContainer.parentNode)
+      if (
+        !result.node &&
+        range.startContainer.nodeType == Node.TEXT_NODE &&
+        range.startOffset == range.startContainer.length &&
+        range.endContainer.nodeType == Node.TEXT_NODE &&
+        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 {
         result.oneElementSelected = true;
       }
     } else {
       // assume table cells !
-      var i, container = null;
+      var i,
+        container = null;
       for (i = 0; i < rangeCount; i++) {
         range = selection.getRangeAt(i);
         if (!container) {
           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;
       }
     }
   }
 
   // make sure we have an element here
-  while (result.node.nodeType != Node.ELEMENT_NODE)
+  while (result.node.nodeType != Node.ELEMENT_NODE) {
     result.node = result.node.parentNode;
+  }
 
   // and make sure the element is not a special editor node like
   // the <br> we insert in blank lines
   // and don't select anonymous content !!! (fix for bug 190279)
-  while (result.node.hasAttribute("_moz_editor_bogus_node") ||
-         editor.isAnonymousElement(result.node))
+  while (
+    result.node.hasAttribute("_moz_editor_bogus_node") ||
+    editor.isAnonymousElement(result.node)
+  ) {
     result.node = result.node.parentNode;
+  }
 
   return result;
 }
 
 function FillInHTMLTooltipEditor(tooltip) {
   const XLinkNS = "http://www.w3.org/1999/xlink";
   var tooltipText = null;
   var node;
@@ -2877,33 +3372,39 @@ function FillInHTMLTooltipEditor(tooltip
         if (tooltipText && /\S/.test(tooltipText)) {
           tooltip.setAttribute("label", tooltipText);
           return true;
         }
       }
     }
   } else {
     for (node = document.tooltipNode; node; node = node.parentNode) {
-      if (ChromeUtils.getClassName(node) === "HTMLImageElement" ||
-          ChromeUtils.getClassName(node) === "HTMLInputElement")
+      if (
+        ChromeUtils.getClassName(node) === "HTMLImageElement" ||
+        ChromeUtils.getClassName(node) === "HTMLInputElement"
+      ) {
         tooltipText = node.getAttribute("src");
-      else if (ChromeUtils.getClassName(node) === "HTMLAnchorElement")
+      } else if (ChromeUtils.getClassName(node) === "HTMLAnchorElement") {
         tooltipText = node.getAttribute("href") || node.getAttribute("name");
+      }
       if (tooltipText) {
         tooltip.setAttribute("label", tooltipText);
         return true;
       }
     }
   }
   return false;
 }
 
 function UpdateTOC() {
-  window.openDialog("chrome://editor/content/EdInsertTOC.xul",
-                    "_blank", "chrome,close,modal,titlebar");
+  window.openDialog(
+    "chrome://editor/content/EdInsertTOC.xul",
+    "_blank",
+    "chrome,close,modal,titlebar"
+  );
   window.content.focus();
 }
 
 function InitTOCMenu() {
   var elt = GetCurrentEditor().document.getElementById("mozToc");
   var createMenuitem = document.getElementById("insertTOCMenuitem");
   var updateMenuitem = document.getElementById("updateTOCMenuitem");
   var removeMenuitem = document.getElementById("removeTOCMenuitem");
--- a/editor/ui/composer/content/editorUtilities.js
+++ b/editor/ui/composer/content/editorUtilities.js
@@ -1,143 +1,177 @@
 /* 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/. */
 
 /* import-globals-from editor.js */
 
-var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-var {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
+var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+var { AppConstants } = ChromeUtils.import(
+  "resource://gre/modules/AppConstants.jsm"
+);
 
 // 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 = {};
 
-var kOutputEncodeBasicEntities = Ci.nsIDocumentEncoder.OutputEncodeBasicEntities;
+var kOutputEncodeBasicEntities =
+  Ci.nsIDocumentEncoder.OutputEncodeBasicEntities;
 var kOutputEncodeHTMLEntities = Ci.nsIDocumentEncoder.OutputEncodeHTMLEntities;
-var kOutputEncodeLatin1Entities = Ci.nsIDocumentEncoder.OutputEncodeLatin1Entities;
+var kOutputEncodeLatin1Entities =
+  Ci.nsIDocumentEncoder.OutputEncodeLatin1Entities;
 var kOutputEncodeW3CEntities = Ci.nsIDocumentEncoder.OutputEncodeW3CEntities;
 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 ***************/
 
 // Optional: Caller may supply text to substitute for "Ok" and/or "Cancel"
 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;
+  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;
+  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
+  );
 }
 
 /** *********** String Utilities ***************/
 
 function GetString(name) {
   if (!gStringBundle) {
     try {
-      gStringBundle = Services.strings.createBundle("chrome://editor/locale/editor.properties");
+      gStringBundle = Services.strings.createBundle(
+        "chrome://editor/locale/editor.properties"
+      );
     } catch (ex) {}
   }
   if (gStringBundle) {
     try {
       return gStringBundle.GetStringFromName(name);
     } catch (e) {}
   }
   return null;
 }
 
 function GetFormattedString(aName, aVal) {
   if (!gStringBundle) {
     try {
-      gStringBundle = Services.strings.createBundle("chrome://editor/locale/editor.properties");
+      gStringBundle = Services.strings.createBundle(
+        "chrome://editor/locale/editor.properties"
+      );
     } catch (ex) {}
   }
   if (gStringBundle) {
     try {
       return gStringBundle.formatStringFromName(aName, [aVal]);
     } catch (e) {}
   }
   return null;
 }
 
 function TrimStringLeft(string) {
-  if (!string)
+  if (!string) {
     return "";
+  }
   return string.trimLeft();
 }
 
 function TrimStringRight(string) {
-  if (!string)
+  if (!string) {
     return "";
+  }
   return string.trimRight();
 }
 
 // Remove whitespace from both ends of a string
 function TrimString(string) {
-  if (!string)
+  if (!string) {
     return "";
+  }
   return string.trim();
 }
 
 function TruncateStringAtWordEnd(string, maxLength, addEllipses) {
   // Return empty if string is null, undefined, or the empty string
-  if (!string)
+  if (!string) {
     return "";
+  }
 
   // We assume they probably don't want whitespace at the beginning
   string = string.trimLeft();
-  if (string.length <= maxLength)
+  if (string.length <= maxLength) {
     return string;
+  }
 
   // We need to truncate the string to maxLength or fewer chars
-  if (addEllipses)
+  if (addEllipses) {
     maxLength -= 3;
+  }
   string = string.replace(RegExp("(.{0," + maxLength + "})\\s.*"), "$1");
 
-  if (string.length > maxLength)
+  if (string.length > maxLength) {
     string = string.slice(0, maxLength);
+  }
 
-  if (addEllipses)
+  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) {
   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, "");
+  return string
+    .replace(/\s+/g, "_")
+    .replace(/[^a-zA-Z0-9_\.\-\:\u0080-\uFFFF]+/g, "");
 }
 
 function GetSelectionAsText() {
   try {
-    return GetCurrentEditor().outputToString("text/plain", kOutputSelectionOnly);
+    return GetCurrentEditor().outputToString(
+      "text/plain",
+      kOutputSelectionOnly
+    );
   } catch (e) {}
 
   return "";
 }
 
-
 /** *********** 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() {
@@ -159,33 +193,33 @@ function GetCurrentEditor() {
     dump(e) + "\n";
   }
 
   return editor;
 }
 
 function GetCurrentTableEditor() {
   var editor = GetCurrentEditor();
-  return (editor && (editor instanceof nsITableEditor)) ? editor : null;
+  return editor && editor instanceof nsITableEditor ? editor : null;
 }
 
 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)
+    if (editorItem) {
       return editorItem;
+    }
 
     tmpWindow = tmpWindow.opener;
-  }
-  while (tmpWindow);
+  } while (tmpWindow);
 
   return null;
 }
 
 function GetCurrentCommandManager() {
   try {
     return GetCurrentEditorElement().commandManager;
   } catch (e) {
@@ -202,46 +236,47 @@ function GetCurrentEditorType() {
     dump(e) + "\n";
   }
 
   return "";
 }
 
 function IsHTMLEditor() {
   // We don't have an editorElement, just return false
-  if (!GetCurrentEditorElement())
+  if (!GetCurrentEditorElement()) {
     return false;
+  }
 
   var editortype = GetCurrentEditorType();
   switch (editortype) {
-      case "html":
-      case "htmlmail":
-        return true;
+    case "html":
+    case "htmlmail":
+      return true;
 
-      case "text":
-      case "textmail":
-        return false;
+    case "text":
+    case "textmail":
+      return false;
 
-      default:
-        dump("INVALID EDITOR TYPE: " + editortype + "\n");
-        break;
+    default:
+      dump("INVALID EDITOR TYPE: " + editortype + "\n");
+      break;
   }
   return false;
 }
 
 function PageIsEmptyAndUntouched() {
   return IsDocumentEmpty() && !IsDocumentModified() && !IsHTMLSourceChanged();
 }
 
 function IsInHTMLSourceMode() {
-  return (gEditorDisplayMode == kDisplayModeSource);
+  return gEditorDisplayMode == kDisplayModeSource;
 }
 
 function IsInPreviewMode() {
-  return (gEditorDisplayMode == kDisplayModePreview);
+  return gEditorDisplayMode == kDisplayModePreview;
 }
 
 // are we editing HTML (i.e. neither in HTML source mode, nor editing a text file)
 function IsEditingRenderedHTML() {
   return IsHTMLEditor() && !IsInHTMLSourceMode();
 }
 
 function IsWebComposer() {
@@ -293,59 +328,76 @@ function GetDocumentTitle() {
   return "";
 }
 
 function SetDocumentTitle(title) {
   try {
     GetCurrentEditorElement().contentDocument.title = title;
 
     // Update window title (doesn't work if called from a dialog)
-    if ("UpdateWindowTitle" in window)
+    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);
+    return GetCurrentEditor().getInlinePropertyWithAttrValue(
+      property,
+      attribute,
+      value,
+      firstHas,
+      anyHas,
+      allHas
+    );
   } catch (e) {}
 }
 
 function EditorSetTextProperty(property, attribute, value) {
   try {
     GetCurrentEditor().setInlineProperty(property, attribute, value);
-    if ("gContentWindow" in window)
+    if ("gContentWindow" in window) {
       window.gContentWindow.focus();
+    }
   } catch (e) {}
 }
 
 function EditorRemoveTextProperty(property, attribute) {
   try {
     GetCurrentEditor().removeInlineProperty(property, attribute);
-    if ("gContentWindow" in window)
+    if ("gContentWindow" in window) {
       window.gContentWindow.focus();
+    }
   } catch (e) {}
 }
 
 /** *********** 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) {
   SetElementEnabled(document.getElementById(elementID), doEnable);
 }
 
 function SetElementEnabled(element, doEnable) {
   if (element) {
-    if (doEnable)
+    if (doEnable) {
       element.removeAttribute("disabled");
-    else
+    } else {
       element.setAttribute("disabled", "true");
+    }
   } else {
     dump("Element  not found in SetElementEnabled\n");
   }
 }
 
 /** *********** Services / Prefs ***************/
 
 function GetFileProtocolHandler() {
@@ -361,212 +413,263 @@ function SetStringPref(aPrefName, aPrefV
 
 // Set initial directory for a filepicker from URLs saved in prefs
 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,
-                                                    Ci.nsIFile);
-      if (location)
+      let location = Services.prefs.getComplexValue(
+        "editor.lastFileLocation." + fileType,
+        Ci.nsIFile
+      );
+      if (location) {
         filePicker.displayDirectory = location;
+      }
     } catch (e) {}
   }
 }
 
 // Save the directory of the selected file to prefs
 function SaveFilePickerDirectory(filePicker, fileType) {
   if (filePicker && filePicker.file) {
     try {
       var fileDir;
-      if (filePicker.file.parent)
+      if (filePicker.file.parent) {
         fileDir = filePicker.file.parent.QueryInterface(Ci.nsIFile);
+      }
 
-        Services.prefs.setComplexValue("editor.lastFileLocation." + fileType,
-                                       Ci.nsIFile, fileDir);
+      Services.prefs.setComplexValue(
+        "editor.lastFileLocation." + fileType,
+        Ci.nsIFile,
+        fileDir
+      );
 
-        Services.prefs.savePrefFile(null);
+      Services.prefs.savePrefFile(null);
     } catch (e) {}
   }
 
   // Restore the directory used before SetFilePickerDirectory was called;
   // This reduces interference with Browser and other module directory defaults
-  if (gFilePickerDirectory)
+  if (gFilePickerDirectory) {
     filePicker.displayDirectory = gFilePickerDirectory;
+  }
 
   gFilePickerDirectory = null;
 }
 
 function GetDefaultBrowserColors() {
-  var colors = { TextColor: 0, BackgroundColor: 0, LinkColor: 0, ActiveLinkColor: 0, VisitedLinkColor: 0 };
-  var useSysColors = Services.prefs.getBoolPref("browser.display.use_system_colors", false);
+  var colors = {
+    TextColor: 0,
+    BackgroundColor: 0,
+    LinkColor: 0,
+    ActiveLinkColor: 0,
+    VisitedLinkColor: 0,
+  };
+  var useSysColors = Services.prefs.getBoolPref(
+    "browser.display.use_system_colors",
+    false
+  );
 
   if (!useSysColors) {
-    colors.TextColor = Services.prefs.getCharPref("browser.display.foreground_color", 0);
-    colors.BackgroundColor = Services.prefs.getCharPref("browser.display.background_color", 0);
+    colors.TextColor = Services.prefs.getCharPref(
+      "browser.display.foreground_color",
+      0
+    );
+    colors.BackgroundColor = Services.prefs.getCharPref(
+      "browser.display.background_color",
+      0
+    );
   }
   // Use OS colors for text and background if explicitly asked or pref is not set
-  if (!colors.TextColor)
+  if (!colors.TextColor) {
     colors.TextColor = "windowtext";
+  }
 
-  if (!colors.BackgroundColor)
+  if (!colors.BackgroundColor) {
     colors.BackgroundColor = "window";
+  }
 
   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 ***************/
 
 function TextIsURI(selectedText) {
-  return selectedText && /^http:\/\/|^https:\/\/|^file:\/\/|^ftp:\/\/|^about:|^mailto:|^news:|^snews:|^telnet:|^ldap:|^ldaps:|^gopher:|^finger:|^javascript:/i.test(selectedText);
+  return (
+    selectedText &&
+    /^http:\/\/|^https:\/\/|^file:\/\/|^ftp:\/\/|^about:|^mailto:|^news:|^snews:|^telnet:|^ldap:|^ldaps:|^gopher:|^finger:|^javascript:/i.test(
+      selectedText
+    )
+  );
 }
 
 function IsUrlAboutBlank(urlString) {
-  return (urlString == "about:blank");
+  return urlString == "about:blank";
 }
 
 function MakeRelativeUrl(url) {
   let inputUrl = url.trim();
-  if (!inputUrl)
+  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);
 
   // Can't relativize if no doc scheme (page hasn't been saved)
-  if (!docScheme)
+  if (!docScheme) {
     return inputUrl;
+  }
 
   var urlScheme = GetScheme(inputUrl);
 
   // Do nothing if not the same scheme or url is already relativized
-  if (docScheme != urlScheme)
+  if (docScheme != urlScheme) {
     return inputUrl;
+  }
 
   // Host must be the same
   var docHost = GetHost(docUrl);
   var urlHost = GetHost(inputUrl);
-  if (docHost != urlHost)
+  if (docHost != urlHost) {
     return inputUrl;
-
+  }
 
   // Get just the file path part of the urls
   // XXX Should we use GetCurrentEditor().documentCharacterSet for 2nd param ?
-  let docPath = Services.io.newURI(docUrl, GetCurrentEditor().documentCharacterSet).pathQueryRef;
-  let urlPath = Services.io.newURI(inputUrl, GetCurrentEditor().documentCharacterSet).pathQueryRef;
+  let docPath = Services.io.newURI(
+    docUrl,
+    GetCurrentEditor().documentCharacterSet
+  ).pathQueryRef;
+  let urlPath = Services.io.newURI(
+    inputUrl,
+    GetCurrentEditor().documentCharacterSet
+  ).pathQueryRef;
 
   // We only return "urlPath", so we can convert the entire docPath for
   // case-insensitive comparisons.
-  var doCaseInsensitive = (docScheme == "file" &&
-                           AppConstants.platform == "win");
-  if (doCaseInsensitive)
+  var doCaseInsensitive = docScheme == "file" && AppConstants.platform == "win";
+  if (doCaseInsensitive) {
     docPath = docPath.toLowerCase();
+  }
 
   // Get document filename before we start chopping up the docPath
   var docFilename = GetFilename(docPath);
 
   // Both url and doc paths now begin with "/"
   // Look for shared dirs starting after that
   urlPath = urlPath.slice(1);
   docPath = docPath.slice(1);
 
   var firstDirTest = true;
   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("\/");
+    nextDocSlash = docPath.indexOf("/");
+    var nextUrlSlash = urlPath.indexOf("/");
 
     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) {
         var anchorIndex = urlPath.indexOf("#");
         if (anchorIndex > 0) {
           var urlFilename = doCaseInsensitive ? urlPath.toLowerCase() : urlPath;
 
-          if (urlFilename.startsWith(docFilename))
+          if (urlFilename.startsWith(docFilename)) {
             urlPath = urlPath.slice(anchorIndex);
+          }
         }
       }
     } else if (nextDocSlash >= 0) {
       // Test for matching subdir
       var docDir = docPath.slice(0, nextDocSlash);
       var urlDir = urlPath.slice(0, nextUrlSlash);
-      if (doCaseInsensitive)
+      if (doCaseInsensitive) {
         urlDir = urlDir.toLowerCase();
+      }
 
       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 {
         // 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")
+        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);
+  } while (!done);
 
   // Add "../" for each dir left in docPath
   while (nextDocSlash > 0) {
     urlPath = "../" + urlPath;
-    nextDocSlash = docPath.indexOf("\/", nextDocSlash + 1);
+    nextDocSlash = docPath.indexOf("/", nextDocSlash + 1);
   }
   return urlPath;
 }
 
 function MakeAbsoluteUrl(url) {
   let resultUrl = TrimString(url);
-  if (!resultUrl)
+  if (!resultUrl) {
     return resultUrl;
+  }
 
   // Check if URL is already absolute, i.e., it has a scheme
   let urlScheme = GetScheme(resultUrl);
 
-  if (urlScheme)
+  if (urlScheme) {
     return resultUrl;
+  }
 
   let docUrl = GetDocumentBaseUrl();
   let docScheme = GetScheme(docUrl);
 
   // Can't relativize if no doc scheme (page hasn't been saved)
-  if (!docScheme)
+  if (!docScheme) {
     return resultUrl;
+  }
 
   // Make a URI object to use its "resolve" method
   let absoluteUrl = resultUrl;
-  let docUri = Services.io.newURI(docUrl, GetCurrentEditor().documentCharacterSet);
+  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);
   } catch (e) {}
 
@@ -576,143 +679,160 @@ function MakeAbsoluteUrl(url) {
 // 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() {
   try {
     var docUrl;
 
     // if document supplies a <base> tag, use that URL instead
     let base = GetCurrentEditor().document.querySelector("base");
-    if (base)
+    if (base) {
       docUrl = base.getAttribute("href");
-    if (!docUrl)
+    }
+    if (!docUrl) {
       docUrl = GetDocumentUrl();
+    }
 
-    if (!IsUrlAboutBlank(docUrl))
+    if (!IsUrlAboutBlank(docUrl)) {
       return docUrl;
+    }
   } catch (e) {}
   return "";
 }
 
 function GetDocumentUrl() {
   try {
     return GetCurrentEditor().document.URL;
   } catch (e) {}
   return "";
 }
 
 // Extract the scheme (e.g., 'file', 'http') from a URL string
 function GetScheme(urlspec) {
   var resultUrl = TrimString(urlspec);
   // Unsaved document URL has no acceptable scheme yet
-  if (!resultUrl || IsUrlAboutBlank(resultUrl))
+  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) {
-  if (!urlspec)
+  if (!urlspec) {
     return "";
+  }
 
   var host = "";
   try {
     host = Services.io.newURI(urlspec).host;
-   } catch (e) {}
+  } catch (e) {}
 
   return host;
 }
 
 function GetUsername(urlspec) {
-  if (!urlspec)
+  if (!urlspec) {
     return "";
+  }
 
   var username = "";
   try {
     username = Services.io.newURI(urlspec).username;
   } catch (e) {}
 
   return username;
 }
 
 function GetFilename(urlspec) {
-  if (!urlspec || IsUrlAboutBlank(urlspec))
+  if (!urlspec || IsUrlAboutBlank(urlspec)) {
     return "";
+  }
 
   var filename;
 
   try {
     let uri = Services.io.newURI(urlspec);
     if (uri) {
       let url = uri.QueryInterface(Ci.nsIURL);
-      if (url)
+      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) {
   urlspec = TrimString(urlspec);
-  if (!urlspec || IsUrlAboutBlank(urlspec))
+  if (!urlspec || IsUrlAboutBlank(urlspec)) {
     return urlspec;
+  }
 
-  if (usernameObj)
+  if (usernameObj) {
     usernameObj.value = "";
-  if (passwordObj)
+  }
+  if (passwordObj) {
     passwordObj.value = "";
+  }
 
   // "@" must exist else we will never detect username or password
   var atIndex = urlspec.indexOf("@");
   if (atIndex > 0) {
     try {
       let uri = Services.io.newURI(urlspec);
       let username = uri.username;
       let password = uri.password;
 
-      if (usernameObj && username)
+      if (usernameObj && username) {
         usernameObj.value = username;
-      if (passwordObj && password)
+      }
+      if (passwordObj && password) {
         passwordObj.value = password;
+      }
       if (username) {
         let usernameStart = urlspec.indexOf(username);
-        if (usernameStart != -1)
+        if (usernameStart != -1) {
           return urlspec.slice(0, usernameStart) + urlspec.slice(atIndex + 1);
+        }
       }
     } catch (e) {}
   }
   return urlspec;
 }
 
 function StripPassword(urlspec, passwordObj) {
   urlspec = TrimString(urlspec);
-  if (!urlspec || IsUrlAboutBlank(urlspec))
+  if (!urlspec || IsUrlAboutBlank(urlspec)) {
     return urlspec;
+  }
 
-  if (passwordObj)
+  if (passwordObj) {
     passwordObj.value = "";
+  }
 
   // "@" must exist else we will never detect password
   var atIndex = urlspec.indexOf("@");
   if (atIndex > 0) {
     try {
       let password = Services.io.newURI(urlspec).password;
 
-      if (passwordObj && password)
+      if (passwordObj && password) {
         passwordObj.value = password;
+      }
       if (password) {
         // Find last ":" before "@"
         let colon = urlspec.lastIndexOf(":", atIndex);
         if (colon != -1) {
           // Include the "@"
           return urlspec.slice(0, colon) + urlspec.slice(atIndex);
         }
       }
@@ -725,102 +845,118 @@ function StripPassword(urlspec, password
 function StripUsernamePasswordFromURI(uri) {
   var urlspec = "";
   if (uri) {
     try {
       urlspec = uri.spec;
       var userPass = uri.userPass;
       if (userPass) {
         let 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) {
-  if (!urlspec || !username)
+  if (!urlspec || !username) {
     return urlspec;
+  }
 
   try {
-    let URI = Services.io.newURI(urlspec, GetCurrentEditor().documentCharacterSet);
+    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)) {
     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;
+    if (b.length == 1) {
+      b = "0" + b;
+    }
     return "#" + r + g + b;
   }
 
-    return color;
+  return color;
 }
 
 /** *********** CSS ***************/
 
 function GetHTMLOrCSSStyleValue(element, attrName, cssPropertyName) {
   var value;
-  if (Services.prefs.getBoolPref("editor.use_css") && IsHTMLEditor())
+  if (Services.prefs.getBoolPref("editor.use_css") && IsHTMLEditor()) {
     value = element.style.getPropertyValue(cssPropertyName);
+  }
 
-  if (!value)
+  if (!value) {
     value = element.getAttribute(attrName);
+  }
 
-  if (!value)
+  if (!value) {
     return "";
+  }
 
   return value;
 }
 
 /** *********** Miscellaneous ***************/
 // Clone simple JS objects
 function Clone(obj) {
   var clone = {};
   for (var i in obj) {
-    if (typeof obj[i] == "object")
+    if (typeof obj[i] == "object") {
       clone[i] = Clone(obj[i]);
-    else
+    } else {
       clone[i] = obj[i];
+    }
   }
   return clone;
 }
 
 /**
  * Utility functions to handle shortended data: URLs in EdColorProps.js and EdImageOverlay.js.
  */
 
 /**
  * Is the passed in image URI a shortened data URI?
  * @return {bool}
  */
 function isImageDataShortened(aImageData) {
-  return (/^data:/i.test(aImageData) && aImageData.includes("…"));
+  return /^data:/i.test(aImageData) && aImageData.includes("…");
 }
 
 /**
  * Event handler for Copy or Cut
  * @param aEvent  the event
  */
 function onCopyOrCutShortened(aEvent) {
   // Put the original data URI onto the clipboard in case the value
   // is a shortened data URI.
   let field = aEvent.target;
   let startPos = field.selectionStart;
-  if (startPos == undefined)
+  if (startPos == undefined) {
     return;
+  }
   let endPos = field.selectionEnd;
   let selection = field.value.substring(startPos, endPos).trim();
 
   // Test that a) the user selected the whole value,
   //           b) the value is a data URI,
   //           c) it contains the ellipsis we added. Otherwise it could be
   //              a new value that the user pasted in.
   if (selection == field.value.trim() && isImageDataShortened(selection)) {
@@ -840,30 +976,38 @@ function onCopyOrCutShortened(aEvent) {
  *
  * @param aImageData    the data: URL of the image to be shortened.
  *                      Note: Original stored in 'aDialogField.fullDataURI'.
  * @param aDialogField  The field of the dialog to contain the data.
  * @return {bool}       URL was shortened?
  */
 function shortenImageData(aImageData, aDialogField) {
   let shortened = false;
-  aDialogField.value = aImageData.replace(/^(data:.+;base64,)(.*)/i,
-    function(match, nonDataPart, dataPart) {
-      if (dataPart.length <= 35)
-        return match;
+  aDialogField.value = aImageData.replace(/^(data:.+;base64,)(.*)/i, function(
+    match,
+    nonDataPart,
+    dataPart
+  ) {
+    if (dataPart.length <= 35) {
+      return match;
+    }
 
-      shortened = true;
-      aDialogField.addEventListener("copy", onCopyOrCutShortened);
-      aDialogField.addEventListener("cut", onCopyOrCutShortened);
-      aDialogField.fullDataURI = aImageData;
-      aDialogField.removeAttribute("tooltiptext");
-      aDialogField.setAttribute("tooltip", "shortenedDataURI");
-      return nonDataPart + dataPart.substring(0, 5) + "…" +
-                           dataPart.substring(dataPart.length - 30);
-    });
+    shortened = true;
+    aDialogField.addEventListener("copy", onCopyOrCutShortened);
+    aDialogField.addEventListener("cut", onCopyOrCutShortened);
+    aDialogField.fullDataURI = aImageData;
+    aDialogField.removeAttribute("tooltiptext");
+    aDialogField.setAttribute("tooltip", "shortenedDataURI");
+    return (
+      nonDataPart +
+      dataPart.substring(0, 5) +
+      "…" +
+      dataPart.substring(dataPart.length - 30)
+    );
+  });
   return shortened;
 }
 
 /**
  * Return full data URIs for a shortened element.
  *
  * @param aDialogField  The field of the dialog containing the data.
  */
--- a/editor/ui/dialogs/content/EdAEAttributes.js
+++ b/editor/ui/dialogs/content/EdAEAttributes.js
@@ -3,24 +3,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // HTML Attributes object for "Name" menulist
 var gHTMLAttr = {};
 
 // JS Events Attributes object for "Name" menulist
 var gJSAttr = {};
 
-
 // Core HTML attribute values //
 // This is appended to Name menulist when "_core" is attribute name
-var gCoreHTMLAttr = [
-  "^id",
-  "class",
-  "title",
-];
+var gCoreHTMLAttr = ["^id", "class", "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 = [
   "onclick",
   "ondblclick",
@@ -52,50 +47,25 @@ var gHTMLColors = [
   "Purple",
   "Red",
   "Silver",
   "Teal",
   "White",
   "Yellow",
 ];
 
-var gHAlign = [
-  "left",
-  "center",
-  "right",
-];
+var gHAlign = ["left", "center", "right"];
 
-var gHAlignJustify = [
-  "left",
-  "center",
-  "right",
-  "justify",
-];
+var gHAlignJustify = ["left", "center", "right", "justify"];
 
-var gHAlignTableContent = [
-  "left",
-  "center",
-  "right",
-  "justify",
-  "char",
-];
+var gHAlignTableContent = ["left", "center", "right", "justify", "char"];
 
-var gVAlignTable = [
-  "top",
-  "middle",
-  "bottom",
-  "baseline",
-];
+var gVAlignTable = ["top", "middle", "bottom", "baseline"];
 
-var gTarget = [
-  "_blank",
-  "_self",
-  "_parent",
-  "_top",
-];
+var gTarget = ["_blank", "_self", "_parent", "_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:
    "elementName_attName".
@@ -111,34 +81,30 @@ 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",
-];
-
+gHTMLAttr.all_dir = ["ltr", "rtl"];
 
 gHTMLAttr.a = [
   "charset",
   "type",
   "name",
   "href",
   "^hreflang",
   "target",
   "rel",
   "rev",
   "!accesskey",
-  "shape",   // with imagemap //
-  "coords",  // with imagemap //
+  "shape", // with imagemap //
+  "coords", // with imagemap //
   "#tabindex",
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
@@ -175,43 +141,23 @@ gHTMLAttr.a_rev = [
   "chapter",
   "section",
   "subsection",
   "appendix",
   "help",
   "bookmark",
 ];
 
-gHTMLAttr.a_shape = [
-  "rect",
-  "circle",
-  "poly",
-  "default",
-];
+gHTMLAttr.a_shape = ["rect", "circle", "poly", "default"];
 
-gHTMLAttr.abbr = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.abbr = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.acronym = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.acronym = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.address = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.address = ["_core", "-", "^lang", "dir"];
 
 // this is deprecated //
 gHTMLAttr.applet = [
   "codebase",
   "archive",
   "code",
   "object",
   "alt",
@@ -220,23 +166,17 @@ gHTMLAttr.applet = [
   "%$height",
   "align",
   "#hspace",
   "#vspace",
   "-",
   "_core",
 ];
 
-gHTMLAttr.applet_align = [
-  "top",
-  "middle",
-  "bottom",
-  "left",
-  "right",
-];
+gHTMLAttr.applet_align = ["top", "middle", "bottom", "left", "right"];
 
 gHTMLAttr.area = [
   "shape",
   "coords",
   "href",
   "nohref",
   "target",
   "$alt",
@@ -246,78 +186,38 @@ gHTMLAttr.area = [
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
 gHTMLAttr.area_target = gTarget;
 
-gHTMLAttr.area_shape = [
-  "rect",
-  "circle",
-  "poly",
-  "default",
-];
+gHTMLAttr.area_shape = ["rect", "circle", "poly", "default"];
 
-gHTMLAttr.area_nohref = [
-  "nohref",
-];
+gHTMLAttr.area_nohref = ["nohref"];
 
-gHTMLAttr.b = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.b = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.base = [
-  "href",
-  "target",
-];
+gHTMLAttr.base = ["href", "target"];
 
 gHTMLAttr.base_target = gTarget;
 
 // this is deprecated //
-gHTMLAttr.basefont = [
-  "^id",
-  "$size",
-  "color",
-  "face",
-];
+gHTMLAttr.basefont = ["^id", "$size", "color", "face"];
 
 gHTMLAttr.basefont_color = gHTMLColors;
 
-gHTMLAttr.bdo = [
-  "_core",
-  "-",
-  "^lang",
-  "$dir",
-];
+gHTMLAttr.bdo = ["_core", "-", "^lang", "$dir"];
 
-gHTMLAttr.bdo_dir = [
-  "ltr",
-  "rtl",
-];
+gHTMLAttr.bdo_dir = ["ltr", "rtl"];
 
-gHTMLAttr.big = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.big = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.blockquote = [
-  "cite",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.blockquote = ["cite", "-", "_core", "-", "^lang", "dir"];
 
 gHTMLAttr.body = [
   "background",
   "bgcolor",
   "text",
   "link",
   "vlink",
   "alink",
@@ -333,91 +233,48 @@ gHTMLAttr.body_bgcolor = gHTMLColors;
 gHTMLAttr.body_text = gHTMLColors;
 
 gHTMLAttr.body_link = gHTMLColors;
 
 gHTMLAttr.body_vlink = gHTMLColors;
 
 gHTMLAttr.body_alink = gHTMLColors;
 
-gHTMLAttr.br = [
-  "clear",
-  "-",
-  "_core",
-];
+gHTMLAttr.br = ["clear", "-", "_core"];
 
-gHTMLAttr.br_clear = [
-  "none",
-  "left",
-  "all",
-  "right",
-];
+gHTMLAttr.br_clear = ["none", "left", "all", "right"];
 
 gHTMLAttr.button = [
   "name",
   "value",
   "$type",
   "disabled",
   "#tabindex",
   "!accesskey",
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
-gHTMLAttr.button_type = [
-  "submit",
-  "button",
-  "reset",
-];
+gHTMLAttr.button_type = ["submit", "button", "reset"];
 
-gHTMLAttr.button_disabled = [
-  "disabled",
-];
+gHTMLAttr.button_disabled = ["disabled"];
 
-gHTMLAttr.caption = [
-  "align",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.caption = ["align", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.caption_align = [
-  "top",
-  "bottom",
-  "left",
-  "right",
-];
-
+gHTMLAttr.caption_align = ["top", "bottom", "left", "right"];
 
 // this is deprecated //
-gHTMLAttr.center = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.center = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.cite = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.cite = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.code = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.code = ["_core", "-", "^lang", "dir"];
 
 gHTMLAttr.col = [
   "#$span",
   "%width",
   "align",
   "!char",
   "#charoff",
   "valign",
@@ -425,28 +282,22 @@ gHTMLAttr.col = [
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
 gHTMLAttr.col_span = [
-  "1",  // default
+  "1", // default
 ];
 
 gHTMLAttr.col_align = gHAlignTableContent;
 
-gHTMLAttr.col_valign = [
-  "top",
-  "middle",
-  "bottom",
-  "baseline",
-];
-
+gHTMLAttr.col_valign = ["top", "middle", "bottom", "baseline"];
 
 gHTMLAttr.colgroup = [
   "#$span",
   "%width",
   "align",
   "!char",
   "#charoff",
   "valign",
@@ -458,117 +309,45 @@ gHTMLAttr.colgroup = [
 ];
 
 gHTMLAttr.colgroup_span = [
   "1", // default
 ];
 
 gHTMLAttr.colgroup_align = gHAlignTableContent;
 
-gHTMLAttr.colgroup_valign = [
-  "top",
-  "middle",
-  "bottom",
-  "baseline",
-];
+gHTMLAttr.colgroup_valign = ["top", "middle", "bottom", "baseline"];
 
-gHTMLAttr.dd = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.dd = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.del = [
-  "cite",
-  "datetime",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.del = ["cite", "datetime", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.dfn = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.dfn = ["_core", "-", "^lang", "dir"];
 
 // this is deprecated //
-gHTMLAttr.dir = [
-  "compact",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.dir = ["compact", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.dir_compact = [
-  "compact",
-];
+gHTMLAttr.dir_compact = ["compact"];
 
-gHTMLAttr.div = [
-  "align",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.div = ["align", "-", "_core", "-", "^lang", "dir"];
 
 gHTMLAttr.div_align = gHAlignJustify;
 
-gHTMLAttr.dl = [
-  "compact",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.dl = ["compact", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.dl_compact = [
-  "compact",
-];
-
+gHTMLAttr.dl_compact = ["compact"];
 
-gHTMLAttr.dt = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.dt = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.em = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.em = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.fieldset = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.fieldset = ["_core", "-", "^lang", "dir"];
 
 // this is deprecated //
-gHTMLAttr.font = [
-  "+size",
-  "color",
-  "face",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.font = ["+size", "color", "face", "-", "_core", "-", "^lang", "dir"];
 
 gHTMLAttr.font_color = gHTMLColors;
 
 gHTMLAttr.form = [
   "$action",
   "$method",
   "enctype",
   "accept",
@@ -577,201 +356,107 @@ gHTMLAttr.form = [
   "target",
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
-gHTMLAttr.form_method = [
-  "get",
-  "post",
-];
+gHTMLAttr.form_method = ["get", "post"];
 
-gHTMLAttr.form_enctype = [
-  "application/x-www-form-urlencoded",
-];
+gHTMLAttr.form_enctype = ["application/x-www-form-urlencoded"];
 
 gHTMLAttr.form_target = gTarget;
 
 gHTMLAttr.frame = [
   "longdesc",
   "name",
   "src",
   "#frameborder",
   "#marginwidth",
   "#marginheight",
   "noresize",
   "$scrolling",
 ];
 
-gHTMLAttr.frame_frameborder = [
-  "1",
-  "0",
-];
+gHTMLAttr.frame_frameborder = ["1", "0"];
 
-gHTMLAttr.frame_noresize = [
-  "noresize",
-];
-
-gHTMLAttr.frame_scrolling = [
-  "auto",
-  "yes",
-  "no",
-];
-
+gHTMLAttr.frame_noresize = ["noresize"];
 
-gHTMLAttr.frameset = [
-  "rows",
-  "cols",
-  "-",
-  "_core",
-];
+gHTMLAttr.frame_scrolling = ["auto", "yes", "no"];
 
-gHTMLAttr.h1 = [
-  "align",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.frameset = ["rows", "cols", "-", "_core"];
+
+gHTMLAttr.h1 = ["align", "-", "_core", "-", "^lang", "dir"];
 
 gHTMLAttr.h1_align = gHAlignJustify;
 
-gHTMLAttr.h2 = [
-  "align",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.h2 = ["align", "-", "_core", "-", "^lang", "dir"];
 
 gHTMLAttr.h2_align = gHAlignJustify;
 
-gHTMLAttr.h3 = [
-  "align",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.h3 = ["align", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.h3_align =  gHAlignJustify;
+gHTMLAttr.h3_align = gHAlignJustify;
 
-gHTMLAttr.h4 = [
-  "align",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.h4 = ["align", "-", "_core", "-", "^lang", "dir"];
 
 gHTMLAttr.h4_align = gHAlignJustify;
 
-
-gHTMLAttr.h5 = [
-  "align",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.h5 = ["align", "-", "_core", "-", "^lang", "dir"];
 
 gHTMLAttr.h5_align = gHAlignJustify;
 
-gHTMLAttr.h6 = [
-  "align",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.h6 = ["align", "-", "_core", "-", "^lang", "dir"];
 
 gHTMLAttr.h6_align = gHAlignJustify;
 
-gHTMLAttr.head = [
-  "profile",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.head = ["profile", "-", "^lang", "dir"];
 
 gHTMLAttr.hr = [
   "align",
   "noshade",
   "#size",
   "%width",
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
 gHTMLAttr.hr_align = gHAlign;
 
-gHTMLAttr.hr_noshade = [
-  "noshade",
-];
-
+gHTMLAttr.hr_noshade = ["noshade"];
 
-gHTMLAttr.html = [
-  "version",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.html = ["version", "-", "^lang", "dir"];
 
-gHTMLAttr.i = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.i = ["_core", "-", "^lang", "dir"];
 
 gHTMLAttr.iframe = [
   "longdesc",
   "name",
   "src",
   "$frameborder",
   "marginwidth",
   "marginheight",
   "$scrolling",
   "align",
   "%height",
   "%width",
   "-",
   "_core",
 ];
 
-gHTMLAttr.iframe_frameborder = [
-  "1",
-  "0",
-];
+gHTMLAttr.iframe_frameborder = ["1", "0"];
 
-gHTMLAttr.iframe_scrolling = [
-  "auto",
-  "yes",
-  "no",
-];
+gHTMLAttr.iframe_scrolling = ["auto", "yes", "no"];
 
-gHTMLAttr.iframe_align = [
-  "top",
-  "middle",
-  "bottom",
-  "left",
-  "right",
-];
+gHTMLAttr.iframe_align = ["top", "middle", "bottom", "left", "right"];
 
 gHTMLAttr.img = [
   "$src",
   "$alt",
   "longdesc",
   "name",
   "%height",
   "%width",
@@ -783,27 +468,19 @@ gHTMLAttr.img = [
   "#vspace",
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
-gHTMLAttr.img_ismap = [
-  "ismap",
-];
+gHTMLAttr.img_ismap = ["ismap"];
 
-gHTMLAttr.img_align = [
-  "top",
-  "middle",
-  "bottom",
-  "left",
-  "right",
-];
+gHTMLAttr.img_align = ["top", "middle", "bottom", "left", "right"];
 
 gHTMLAttr.input = [
   "$type",
   "name",
   "value",
   "checked",
   "disabled",
   "readonly",
@@ -832,116 +509,41 @@ gHTMLAttr.input_type = [
   "submit",
   "reset",
   "file",
   "hidden",
   "image",
   "button",
 ];
 
-gHTMLAttr.input_checked = [
-  "checked",
-];
-
-gHTMLAttr.input_disabled = [
-  "disabled",
-];
+gHTMLAttr.input_checked = ["checked"];
 
-gHTMLAttr.input_readonly = [
-  "readonly",
-];
-
+gHTMLAttr.input_disabled = ["disabled"];
 
-gHTMLAttr.input_ismap = [
-  "ismap",
-];
-
+gHTMLAttr.input_readonly = ["readonly"];
 
-gHTMLAttr.input_align = [
-  "top",
-  "middle",
-  "bottom",
-  "left",
-  "right",
-];
+gHTMLAttr.input_ismap = ["ismap"];
 
-gHTMLAttr.ins = [
-  "cite",
-  "datetime",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.input_align = ["top", "middle", "bottom", "left", "right"];
 
-gHTMLAttr.isindex = [
-  "prompt",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.ins = ["cite", "datetime", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.kbd = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.isindex = ["prompt", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.label = [
-  "for",
-  "!accesskey",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.kbd = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.legend = [
-  "!accesskey",
-  "align",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.label = ["for", "!accesskey", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.legend_align = [
-  "top",
-  "bottom",
-  "left",
-  "right",
-];
+gHTMLAttr.legend = ["!accesskey", "align", "-", "_core", "-", "^lang", "dir"];
+
+gHTMLAttr.legend_align = ["top", "bottom", "left", "right"];
 
-gHTMLAttr.li = [
-  "type",
-  "#value",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.li = ["type", "#value", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.li_type = [
-  "disc",
-  "square",
-  "circle",
-  "-",
-  "1",
-  "a",
-  "A",
-  "i",
-  "I",
-];
+gHTMLAttr.li_type = ["disc", "square", "circle", "-", "1", "a", "A", "i", "I"];
 
 gHTMLAttr.link = [
   "charset",
   "href",
   "^hreflang",
   "type",
   "rel",
   "rev",
@@ -987,61 +589,35 @@ gHTMLAttr.link_rev = [
   "chapter",
   "section",
   "subsection",
   "appendix",
   "help",
   "bookmark",
 ];
 
-gHTMLAttr.map = [
-  "$name",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.map = ["$name", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.menu = [
-  "compact",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.menu = ["compact", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.menu_compact = [
-  "compact",
-];
+gHTMLAttr.menu_compact = ["compact"];
 
 gHTMLAttr.meta = [
   "http-equiv",
   "name",
   "$content",
   "scheme",
   "-",
   "^lang",
   "dir",
 ];
 
-gHTMLAttr.noframes = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.noframes = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.noscript = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.noscript = ["_core", "-", "^lang", "dir"];
 
 gHTMLAttr.object = [
   "declare",
   "classid",
   "codebase",
   "data",
   "type",
   "codetype",
@@ -1058,230 +634,96 @@ gHTMLAttr.object = [
   "#vspace",
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
-gHTMLAttr.object_declare = [
-  "declare",
-];
+gHTMLAttr.object_declare = ["declare"];
 
-gHTMLAttr.object_align = [
-  "top",
-  "middle",
-  "bottom",
-  "left",
-  "right",
-];
+gHTMLAttr.object_align = ["top", "middle", "bottom", "left", "right"];
 
-gHTMLAttr.ol = [
-  "type",
-  "compact",
-  "#start",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.ol = ["type", "compact", "#start", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.ol_type = [
-  "1",
-  "a",
-  "A",
-  "i",
-  "I",
-];
+gHTMLAttr.ol_type = ["1", "a", "A", "i", "I"];
 
-gHTMLAttr.ol_compact = [
-  "compact",
-];
-
+gHTMLAttr.ol_compact = ["compact"];
 
-gHTMLAttr.optgroup = [
-  "disabled",
-  "$label",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.optgroup = ["disabled", "$label", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.optgroup_disabled = [
-  "disabled",
-];
-
+gHTMLAttr.optgroup_disabled = ["disabled"];
 
 gHTMLAttr.option = [
   "selected",
   "disabled",
   "label",
   "value",
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
-gHTMLAttr.option_selected = [
-  "selected",
-];
-
-gHTMLAttr.option_disabled = [
-  "disabled",
-];
-
+gHTMLAttr.option_selected = ["selected"];
 
-gHTMLAttr.p = [
-  "align",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.option_disabled = ["disabled"];
+
+gHTMLAttr.p = ["align", "-", "_core", "-", "^lang", "dir"];
 
 gHTMLAttr.p_align = gHAlignJustify;
 
-gHTMLAttr.param = [
-  "^id",
-  "$name",
-  "value",
-  "$valuetype",
-  "type",
-];
+gHTMLAttr.param = ["^id", "$name", "value", "$valuetype", "type"];
+
+gHTMLAttr.param_valuetype = ["data", "ref", "object"];
 
-gHTMLAttr.param_valuetype = [
-  "data",
-  "ref",
-  "object",
-];
-
+gHTMLAttr.pre = ["%width", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.pre = [
-  "%width",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.q = ["cite", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.q = [
-  "cite",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.s = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.s = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.samp = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.samp = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.script = ["charset", "$type", "language", "src", "defer"];
 
-gHTMLAttr.script = [
-  "charset",
-  "$type",
-  "language",
-  "src",
-  "defer",
-];
-
-gHTMLAttr.script_defer = [
-  "defer",
-];
-
+gHTMLAttr.script_defer = ["defer"];
 
 gHTMLAttr.select = [
   "name",
   "#size",
   "multiple",
   "disabled",
   "#tabindex",
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
-gHTMLAttr.select_multiple = [
-  "multiple",
-];
+gHTMLAttr.select_multiple = ["multiple"];
 
-gHTMLAttr.select_disabled = [
-  "disabled",
-];
+gHTMLAttr.select_disabled = ["disabled"];
 
-gHTMLAttr.small = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.small = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.span = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
-
-gHTMLAttr.strike = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.span = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.strong = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.strike = ["_core", "-", "^lang", "dir"];
+
+gHTMLAttr.strong = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.style = [
-  "$type",
-  "media",
-  "title",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.style = ["$type", "media", "title", "-", "^lang", "dir"];
 
-gHTMLAttr.sub = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.sub = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.sup = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.sup = ["_core", "-", "^lang", "dir"];
 
 gHTMLAttr.table = [
   "summary",
   "%width",
   "#border",
   "frame",
   "rules",
   "#cellspacing",
@@ -1302,23 +744,17 @@ gHTMLAttr.table_frame = [
   "hsides",
   "lhs",
   "rhs",
   "vsides",
   "box",
   "border",
 ];
 
-gHTMLAttr.table_rules = [
-  "none",
-  "groups",
-  "rows",
-  "cols",
-  "all",
-];
+gHTMLAttr.table_rules = ["none", "groups", "rows", "cols", "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;
 
 gHTMLAttr.tbody = [
@@ -1354,38 +790,31 @@ gHTMLAttr.td = [
   "%height",
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
-gHTMLAttr.td_scope = [
-  "row",
-  "col",
-  "rowgroup",
-  "colgroup",
-];
+gHTMLAttr.td_scope = ["row", "col", "rowgroup", "colgroup"];
 
 gHTMLAttr.td_rowspan = [
   "1", // default
 ];
 
 gHTMLAttr.td_colspan = [
   "1", // default
 ];
 
 gHTMLAttr.td_align = gHAlignTableContent;
 
 gHTMLAttr.td_valign = gVAlignTable;
 
-gHTMLAttr.td_nowrap = [
-  "nowrap",
-];
+gHTMLAttr.td_nowrap = ["nowrap"];
 
 gHTMLAttr.td_bgcolor = gHTMLColors;
 
 gHTMLAttr.textarea = [
   "name",
   "$#rows",
   "$#cols",
   "disabled",
@@ -1394,24 +823,19 @@ gHTMLAttr.textarea = [
   "!accesskey",
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
-gHTMLAttr.textarea_disabled = [
-  "disabled",
-];
+gHTMLAttr.textarea_disabled = ["disabled"];
 
-gHTMLAttr.textarea_readonly = [
-  "readonly",
-];
-
+gHTMLAttr.textarea_readonly = ["readonly"];
 
 gHTMLAttr.tfoot = [
   "align",
   "!char",
   "#charoff",
   "valign",
   "-",
   "_core",
@@ -1441,38 +865,31 @@ gHTMLAttr.th = [
   "%height",
   "-",
   "_core",
   "-",
   "^lang",
   "dir",
 ];
 
-gHTMLAttr.th_scope = [
-  "row",
-  "col",
-  "rowgroup",
-  "colgroup",
-];
+gHTMLAttr.th_scope = ["row", "col", "rowgroup", "colgroup"];
 
 gHTMLAttr.th_rowspan = [
   "1", // default
 ];
 
 gHTMLAttr.th_colspan = [
   "1", // default
 ];
 
 gHTMLAttr.th_align = gHAlignTableContent;
 
 gHTMLAttr.th_valign = gVAlignTable;
 
-gHTMLAttr.th_nowrap = [
-  "nowrap",
-];
+gHTMLAttr.th_nowrap = ["nowrap"];
 
 gHTMLAttr.th_bgcolor = gHTMLColors;
 
 gHTMLAttr.thead = [
   "align",
   "!char",
   "#charoff",
   "valign",
@@ -1482,20 +899,17 @@ gHTMLAttr.thead = [
   "^lang",
   "dir",
 ];
 
 gHTMLAttr.thead_align = gHAlignTableContent;
 
 gHTMLAttr.thead_valign = gVAlignTable;
 
-gHTMLAttr.title = [
-  "^lang",
-  "dir",
-];
+gHTMLAttr.title = ["^lang", "dir"];
 
 gHTMLAttr.tr = [
   "align",
   "!char",
   "#charoff",
   "valign",
   "bgcolor",
   "-",
@@ -1506,128 +920,54 @@ gHTMLAttr.tr = [
 ];
 
 gHTMLAttr.tr_align = gHAlignTableContent;
 
 gHTMLAttr.tr_valign = gVAlignTable;
 
 gHTMLAttr.tr_bgcolor = gHTMLColors;
 
-gHTMLAttr.tt = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.tt = ["_core", "-", "^lang", "dir"];
 
-gHTMLAttr.u = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
-gHTMLAttr.ul = [
-  "type",
-  "compact",
-  "-",
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr.u = ["_core", "-", "^lang", "dir"];
+gHTMLAttr.ul = ["type", "compact", "-", "_core", "-", "^lang", "dir"];
 
-gHTMLAttr.ul_type = [
-  "disc",
-  "square",
-  "circle",
-];
+gHTMLAttr.ul_type = ["disc", "square", "circle"];
 
-gHTMLAttr.ul_compact = [
-  "compact",
-];
-
+gHTMLAttr.ul_compact = ["compact"];
 
 // Prefix with "_" since this is reserved (it's stripped out)
-gHTMLAttr._var = [
-  "_core",
-  "-",
-  "^lang",
-  "dir",
-];
+gHTMLAttr._var = ["_core", "-", "^lang", "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",
-];
+gJSAttr.a = ["onfocus", "onblur"];
 
-gJSAttr.area = [
-  "onfocus",
-  "onblur",
-];
+gJSAttr.area = ["onfocus", "onblur"];
 
-gJSAttr.body = [
-  "onload",
-  "onupload",
-];
+gJSAttr.body = ["onload", "onupload"];
 
-gJSAttr.button = [
-  "onfocus",
-  "onblur",
-];
+gJSAttr.button = ["onfocus", "onblur"];
 
-gJSAttr.form = [
-  "onsubmit",
-  "onreset",
-];
+gJSAttr.form = ["onsubmit", "onreset"];
 
-gJSAttr.frameset = [
-  "onload",
-  "onunload",
-];
+gJSAttr.frameset = ["onload", "onunload"];
 
-gJSAttr.input = [
-  "onfocus",
-  "onblur",
-  "onselect",
-  "onchange",
-];
+gJSAttr.input = ["onfocus", "onblur", "onselect", "onchange"];
 
-gJSAttr.label = [
-  "onfocus",
-  "onblur",
-];
+gJSAttr.label = ["onfocus", "onblur"];
 
-gJSAttr.select = [
-  "onfocus",
-  "onblur",
-  "onchange",
-];
+gJSAttr.select = ["onfocus", "onblur", "onchange"];
 
-gJSAttr.textarea = [
-  "onfocus",
-  "onblur",
-  "onselect",
-  "onchange",
-];
+gJSAttr.textarea = ["onfocus", "onblur", "onselect", "onchange"];
 
 // Elements that don't have JSEvents:
-gJSAttr.font = [
-  "noJSEvents",
-];
+gJSAttr.font = ["noJSEvents"];
 
-gJSAttr.applet = [
-  "noJSEvents",
-];
+gJSAttr.applet = ["noJSEvents"];
 
-gJSAttr.isindex = [
-  "noJSEvents",
-];
+gJSAttr.isindex = ["noJSEvents"];
 
-gJSAttr.iframe = [
-  "noJSEvents",
-];
-
+gJSAttr.iframe = ["noJSEvents"];
--- a/editor/ui/dialogs/content/EdAECSSAttributes.js
+++ b/editor/ui/dialogs/content/EdAECSSAttributes.js
@@ -32,84 +32,99 @@ function BuildCSSAttributeTable() {
     }
   }
 
   ClearCSSInputWidgets();
 }
 
 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)
+  if (!UpdateExistingAttribute(name, value, "CSSAList") && value) {
     AddTreeItem(name, value, "CSSAList", CSSAttrs);
+  }
 }
 
 function ClearCSSInputWidgets() {
   gDialog.AddCSSAttributeTree.view.selection.clearSelection();
   gDialog.AddCSSAttributeNameInput.value = "";
   gDialog.AddCSSAttributeValueInput.value = "";
   SetTextboxFocus(gDialog.AddCSSAttributeNameInput);
 }
 
 function onSelectCSSTreeItem() {
-  if (!gDoOnSelectTree)
+  if (!gDoOnSelectTree) {
     return;
+  }
 
   var tree = gDialog.AddCSSAttributeTree;
   if (tree && tree.view.selection.count) {
-    gDialog.AddCSSAttributeNameInput.value = GetTreeItemAttributeStr(getSelectedItem(tree));
-    gDialog.AddCSSAttributeValueInput.value = GetTreeItemValueStr(getSelectedItem(tree));
+    gDialog.AddCSSAttributeNameInput.value = GetTreeItemAttributeStr(
+      getSelectedItem(tree)
+    );
+    gDialog.AddCSSAttributeValueInput.value = GetTreeItemValueStr(
+      getSelectedItem(tree)
+    );
   }
 }
 
 function onInputCSSAttributeName() {
-  var attName = TrimString(gDialog.AddCSSAttributeNameInput.value).toLowerCase();
+  var attName = TrimString(
+    gDialog.AddCSSAttributeNameInput.value
+  ).toLowerCase();
   var newValue = "";
 
   var existingValue = GetAndSelectExistingAttributeValue(attName, "CSSAList");
-  if (existingValue)
+  if (existingValue) {
     newValue = existingValue;
+  }
 
   gDialog.AddCSSAttributeValueInput.value = newValue;
 }
 
 function editCSSAttributeValue(targetCell) {
-  if (IsNotTreeHeader(targetCell))
+  if (IsNotTreeHeader(targetCell)) {
     gDialog.AddCSSAttributeValueInput.inputField.select();
+  }
 }
 
 function UpdateCSSAttributes() {
   var CSSAList = document.getElementById("CSSAList");
   var styleString = "";
   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(":"))
+    if (name.includes(":")) {
       name = name.substring(0, name.lastIndexOf(":"));
-    if (value.includes(";"))
+    }
+    if (value.includes(";")) {
       value = value.substring(0, value.lastIndexOf(";"));
-    if (i == (CSSAList.childNodes.length - 1))
-      styleString += name + ": " + value + ";";   // last property
-    else
+    }
+    if (i == CSSAList.childNodes.length - 1) {
+      styleString += name + ": " + value + ";";
+    } // last property
+    else {
       styleString += name + ": " + value + "; ";
+    }
   }
   if (styleString) {
     // Use editor transactions if modifying the element directly in the document
     doRemoveAttribute("style");
-    doSetAttribute("style", styleString);  // NOTE BUG 18894!!!
+    doSetAttribute("style", styleString); // NOTE BUG 18894!!!
   } else if (gElement.getAttribute("style")) {
     doRemoveAttribute("style");
   }
 }
 
 function RemoveCSSAttribute() {
   // We only allow 1 selected item
   if (gDialog.AddCSSAttributeTree.view.selection.count) {
--- a/editor/ui/dialogs/content/EdAEHTMLAttributes.js
+++ b/editor/ui/dialogs/content/EdAEHTMLAttributes.js
@@ -33,99 +33,116 @@ function BuildHTMLAttributeNameList() {
             gDialog.AddHTMLAttributeNameInput.appendItem(name, name);
           }
         }
       } else if (name == "-") {
         // Signal for separator
         var popup = gDialog.AddHTMLAttributeNameInput.menupopup;
         if (popup) {
           var sep = document.createXULElement("menuseparator");
-          if (sep)
+          if (sep) {
             popup.appendChild(sep);
+          }
         }
       } 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 limitFirstChar = name.includes("^");
         // let required = name.includes("$");
 
         // Strip flag characters
         name = name.replace(/[!^#%$+]/g, "");
 
         menuitem = gDialog.AddHTMLAttributeNameInput.appendItem(name, name);
         if (menuitem) {
           // Signify "required" attributes by special style
           // TODO: Don't do this until next version, when we add
           //      explanatory text and an 'Autofill Required Attributes' button
           // if (required)
           //  menuitem.setAttribute("class", "menuitem-highlight-1");
 
           // Set flags to filter value input
-          if (forceOneChar)
+          if (forceOneChar) {
             menuitem.setAttribute("forceOneChar", "true");
-          if (limitFirstChar)
+          }
+          if (limitFirstChar) {
             menuitem.setAttribute("limitFirstChar", "true");
-          if (forceInteger)
+          }
+          if (forceInteger) {
             menuitem.setAttribute("forceInteger", "true");
-          if (forceSignedInteger)
+          }
+          if (forceSignedInteger) {
             menuitem.setAttribute("forceSignedInteger", "true");
-          if (forceIntOrPercent)
+          }
+          if (forceIntOrPercent) {
             menuitem.setAttribute("forceIntOrPercent", "true");
+          }
         }
       }
     }
   }
 }
 
 // build attribute list in tree form from element attributes
 function BuildHTMLAttributeTable() {
   var nodeMap = gElement.attributes;
   var i;
   if (nodeMap.length > 0) {
     var added = false;
     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") {
-        continue;   // repeated or non-HTML attribute, ignore this one and go to next
+      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)) {
+      if (
+        !name.startsWith("_moz") &&
+        AddTreeItem(name, nodeMap[i].value, "HTMLAList", HTMLAttrs)
+      ) {
         added = true;
       }
     }
 
-    if (added)
+    if (added) {
       SelectHTMLTree(0);
+    }
   }
 }
 
 function ClearHTMLInputWidgets() {
   gDialog.AddHTMLAttributeTree.view.selection.clearSelection();
   gDialog.AddHTMLAttributeNameInput.value = "";
   gDialog.AddHTMLAttributeValueInput.value = "";
   SetTextboxFocus(gDialog.AddHTMLAttributeNameInput);
 }
 
 function onSelectHTMLTreeItem() {
-  if (!gDoOnSelectTree)
+  if (!gDoOnSelectTree) {
     return;
+  }
 
   var tree = gDialog.AddHTMLAttributeTree;
   if (tree && tree.view.selection.count) {
-    var inputName = TrimString(gDialog.AddHTMLAttributeNameInput.value).toLowerCase();
+    var inputName = TrimString(
+      gDialog.AddHTMLAttributeNameInput.value
+    ).toLowerCase();
     var selectedItem = getSelectedItem(tree);
     var selectedName = selectedItem.firstChild.firstChild.getAttribute("label");
 
     if (inputName == selectedName) {
       // Already editing selected name - just update the value input
-      gDialog.AddHTMLAttributeValueInput.value = GetTreeItemValueStr(selectedItem);
+      gDialog.AddHTMLAttributeValueInput.value = GetTreeItemValueStr(
+        selectedItem
+      );
     } else {
       gDialog.AddHTMLAttributeNameInput.value = selectedName;
 
       // Change value input based on new selected name
       onInputHTMLAttributeName();
     }
   }
 }
@@ -140,158 +157,185 @@ function onInputHTMLAttributeName() {
 
   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")
+    if (attName == "dir") {
       valueListName = "all_dir";
-    else
+    } else {
       valueListName = gElement.localName + "_" + attName;
+    }
 
     // Strip off leading "_" we sometimes use (when element name is reserved word)
-    if (valueListName.startsWith("_"))
+    if (valueListName.startsWith("_")) {
       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");
+    var deckIndex = gDialog.AddHTMLAttributeValueDeck.getAttribute(
+      "selectedIndex"
+    );
 
     if (valueListName in gHTMLAttr) {
       var valueList = gHTMLAttr[valueListName];
 
       listLen = valueList.length;
-      if (listLen == 1)
+      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) {
         gDialog.AddHTMLAttributeValueMenulist.removeAllItems();
 
         if (deckIndex != "1") {
           // Switch to using editable menulist
-          gDialog.AddHTMLAttributeValueInput = gDialog.AddHTMLAttributeValueMenulist;
+          gDialog.AddHTMLAttributeValueInput =
+            gDialog.AddHTMLAttributeValueMenulist;
           gDialog.AddHTMLAttributeValueDeck.setAttribute("selectedIndex", "1");
         }
         // Rebuild the list
         for (var i = 0; i < listLen; i++) {
           if (valueList[i] == "-") {
             // Signal for separator
             var popup = gDialog.AddHTMLAttributeValueInput.menupopup;
             if (popup) {
               var sep = document.createXULElement("menuseparator");
-              if (sep)
+              if (sep) {
                 popup.appendChild(sep);
+              }
             }
           } else {
-            gDialog.AddHTMLAttributeValueMenulist.appendItem(valueList[i], valueList[i]);
+            gDialog.AddHTMLAttributeValueMenulist.appendItem(
+              valueList[i],
+              valueList[i]
+            );
           }
         }
       }
     }
 
     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");
-    if (existingValue)
+    var existingValue = GetAndSelectExistingAttributeValue(
+      attName,
+      "HTMLAList"
+    );
+    if (existingValue) {
       newValue = existingValue;
+    }
 
     gDialog.AddHTMLAttributeValueInput.value = newValue;
 
-    if (!existingValue)
+    if (!existingValue) {
       onInputHTMLAttributeValue();
+    }
   }
 }
 
 function onInputHTMLAttributeValue() {
-  if (!gUpdateTreeValue)
+  if (!gUpdateTreeValue) {
     return;
+  }
 
   var name = TrimString(gDialog.AddHTMLAttributeNameInput.value);
-  if (!name)
+  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) {
     // 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.getAttribute("forceOneChar") == "true" &&
+        value.length > 1
+      ) {
         value = value.slice(0, 1);
+      }
 
       if (selectedItem.getAttribute("forceIntOrPercent") == "true") {
         // Allow integer with optional "%" as last character
         var percent = TrimStringRight(value).slice(-1);
         value = value.replace(/\D+/g, "");
-        if (percent == "%")
+        if (percent == "%") {
           value += percent;
+        }
       } 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, "");
-        if (sign == "+" || sign == "-")
+        if (sign == "+" || sign == "-") {
           value = sign + value;
+        }
       }
 
       // Special case attributes
       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)
+      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)
+  if (!UpdateExistingAttribute(name, value, "HTMLAList") && value) {
     AddTreeItem(name, value, "HTMLAList", HTMLAttrs);
+  }
 }
 
 function editHTMLAttributeValue(targetCell) {
-  if (IsNotTreeHeader(targetCell))
+  if (IsNotTreeHeader(targetCell)) {
     gDialog.AddHTMLAttributeValueInput.select();
+  }
 }
 
-
 // update the object with added and removed attributes
 function UpdateHTMLAttributes() {
   var HTMLAList = document.getElementById("HTMLAList");
   var i;
 
   // remove removed attributes
   for (i = 0; i < HTMLRAttrs.length; i++) {
     var name = HTMLRAttrs[i];
 
-    if (gElement.hasAttribute(name))
+    if (gElement.hasAttribute(name)) {
       doRemoveAttribute(name);
+    }
   }
 
   // Set added or changed attributes
   for (i = 0; i < HTMLAList.childNodes.length; i++) {
     var item = HTMLAList.childNodes[i];
     doSetAttribute(GetTreeItemAttributeStr(item), GetTreeItemValueStr(item));
   }
 }
--- a/editor/ui/dialogs/content/EdAEJSEAttributes.js
+++ b/editor/ui/dialogs/content/EdAEJSEAttributes.js
@@ -17,126 +17,149 @@ function BuildJSEAttributeNameList() {
     var popup;
     var sep;
 
     if (attNames && attNames.length) {
       // Since we don't allow user-editable JS events yet (but we will soon)
       //  simply remove the JS tab to not allow adding JS events
       if (attNames[0] == "noJSEvents") {
         var tab = document.getElementById("tabJSE");
-        if (tab)
+        if (tab) {
           tab.remove();
+        }
 
         return;
       }
 
-      for (i = 0; i < attNames.length; i++)
+      for (i = 0; i < attNames.length; i++) {
         gDialog.AddJSEAttributeNameList.appendItem(attNames[i], attNames[i]);
+      }
 
       popup = gDialog.AddJSEAttributeNameList.firstChild;
       if (popup) {
         sep = document.createXULElement("menuseparator");
-        if (sep)
+        if (sep) {
           popup.appendChild(sep);
+        }
       }
     }
   }
 
   // Always add core JS events unless we aborted above
   for (i = 0; i < gCoreJSEvents.length; i++) {
     if (gCoreJSEvents[i] == "-") {
-      if (!popup)
+      if (!popup) {
         popup = gDialog.AddJSEAttributeNameList.firstChild;
+      }
 
       sep = document.createXULElement("menuseparator");
 
-      if (popup && sep)
+      if (popup && sep) {
         popup.appendChild(sep);
+      }
     } else {
-      gDialog.AddJSEAttributeNameList.appendItem(gCoreJSEvents[i], gCoreJSEvents[i]);
+      gDialog.AddJSEAttributeNameList.appendItem(
+        gCoreJSEvents[i],
+        gCoreJSEvents[i]
+      );
     }
   }
 
   gDialog.AddJSEAttributeNameList.selectedIndex = 0;
 
   // Use current name and value of first tree item if it exists
   onSelectJSETreeItem();
 }
 
 // build attribute list in tree form from element attributes
 function BuildJSEAttributeTable() {
   var nodeMap = gElement.attributes;
   if (nodeMap.length > 0) {
     var added = false;
     for (var i = 0; i < nodeMap.length; i++) {
       let name = nodeMap[i].nodeName.toLowerCase();
-      if (CheckAttributeNameSimilarity(nodeMap[i].nodeName, JSEAttrs))
-        continue;   // repeated or non-JS handler, ignore this one and go to next
-      if (!name.startsWith("on"))
-        continue; // attribute isn't an event handler.
+      if (CheckAttributeNameSimilarity(nodeMap[i].nodeName, JSEAttrs)) {
+        continue;
+      } // repeated or non-JS handler, ignore this one and go to next
+      if (!name.startsWith("on")) {
+        continue;
+      } // attribute isn't an event handler.
       var value = gElement.getAttribute(nodeMap[i].nodeName);
-      if (AddTreeItem(name, value, "JSEAList", JSEAttrs)) // add item to tree
+      if (AddTreeItem(name, value, "JSEAList", JSEAttrs)) {
+        // add item to tree
         added = true;
+      }
     }
 
     // Select first item
-    if (added)
+    if (added) {
       gDialog.AddJSEAttributeTree.selectedIndex = 0;
+    }
   }
 }
 
 function onSelectJSEAttribute() {
-  if (!gDoOnSelectTree)
+  if (!gDoOnSelectTree) {
     return;
+  }
 
-  gDialog.AddJSEAttributeValueInput.value =
-      GetAndSelectExistingAttributeValue(gDialog.AddJSEAttributeNameList.label, "JSEAList");
+  gDialog.AddJSEAttributeValueInput.value = GetAndSelectExistingAttributeValue(
+    gDialog.AddJSEAttributeNameList.label,
+    "JSEAList"
+  );
 }
 
 function onSelectJSETreeItem() {
   var tree = gDialog.AddJSEAttributeTree;
   if (tree && tree.view.selection.count) {
     // Select attribute name in list
-    gDialog.AddJSEAttributeNameList.value = GetTreeItemAttributeStr(getSelectedItem(tree));
+    gDialog.AddJSEAttributeNameList.value = GetTreeItemAttributeStr(
+      getSelectedItem(tree)
+    );
 
     // Set value input to that in tree (no need to update this in the tree)
     gUpdateTreeValue = false;
-    gDialog.AddJSEAttributeValueInput.value =  GetTreeItemValueStr(getSelectedItem(tree));
+    gDialog.AddJSEAttributeValueInput.value = GetTreeItemValueStr(
+      getSelectedItem(tree)
+    );
     gUpdateTreeValue = true;
   }
 }
 
 function onInputJSEAttributeValue() {
   if (gUpdateTreeValue) {
     var name = TrimString(gDialog.AddJSEAttributeNameList.label);
     var value = TrimString(gDialog.AddJSEAttributeValueInput.value);
 
     // Update value in the tree list
     // Since we have a non-editable menulist,
     //   we MUST automatically add the event attribute if it doesn't exist
-    if (!UpdateExistingAttribute(name, value, "JSEAList") && value)
+    if (!UpdateExistingAttribute(name, value, "JSEAList") && value) {
       AddTreeItem(name, value, "JSEAList", JSEAttrs);
+    }
   }
 }
 
 function editJSEAttributeValue(targetCell) {
-  if (IsNotTreeHeader(targetCell))
+  if (IsNotTreeHeader(targetCell)) {
     gDialog.AddJSEAttributeValueInput.inputField.select();
+  }
 }
 
 function UpdateJSEAttributes() {
   var JSEAList = document.getElementById("JSEAList");
   var i;
 
   // remove removed attributes
   for (i = 0; i < JSERAttrs.length; i++) {
     var name = JSERAttrs[i];
 
-    if (gElement.hasAttribute(name))
+    if (gElement.hasAttribute(name)) {
       doRemoveAttribute(name);
+    }
   }
 
   // Add events
   for (i = 0; i < JSEAList.childNodes.length; i++) {
     var item = JSEAList.childNodes[i];
 
     // set the event handler
     doSetAttribute(GetTreeItemAttributeStr(item), GetTreeItemValueStr(item));
@@ -153,18 +176,19 @@ function RemoveJSEAttribute() {
   // We only allow 1 selected item
   if (gDialog.AddJSEAttributeTree.view.selection.count) {
     var item = getSelectedItem(gDialog.AddJSEAttributeTree);
 
     // Name is the text of the treecell
     var attr = GetTreeItemAttributeStr(item);
 
     // remove the item from the attribute array
-    if (newIndex >= (JSEAttrs.length - 1))
+    if (newIndex >= JSEAttrs.length - 1) {
       newIndex--;
+    }
 
     // remove the item from the attribute array
     JSERAttrs[JSERAttrs.length] = attr;
     RemoveNameFromAttArray(attr, JSEAttrs);
 
     // Remove the item from the tree
     item.remove();
 
--- a/editor/ui/dialogs/content/EdAdvancedEdit.js
+++ b/editor/ui/dialogs/content/EdAdvancedEdit.js
@@ -5,24 +5,24 @@
 /* import-globals-from ../../composer/content/editorUtilities.js */
 /* import-globals-from EdAEAttributes.js */
 /* import-globals-from EdAECSSAttributes.js */
 /* import-globals-from EdAEHTMLAttributes.js */
 /* import-globals-from EdAEJSEAttributes.js */
 /* import-globals-from EdDialogCommon.js */
 
 /** ************         GLOBALS         **************/
-var gElement    = null; // handle to actual element edited
+var gElement = null; // handle to actual element edited
 
-var HTMLAttrs   = [];   // html attributes
-var CSSAttrs    = [];   // css attributes
-var JSEAttrs    = [];   // js events
+var HTMLAttrs = []; // html attributes
+var CSSAttrs = []; // css attributes
+var JSEAttrs = []; // js events
 
-var HTMLRAttrs  = [];   // removed html attributes
-var JSERAttrs   = [];   // removed js events
+var HTMLRAttrs = []; // removed html attributes
+var JSERAttrs = []; // removed js events
 
 /* Set false to allow changing selection in tree
    without doing "onselect" handler actions
 */
 var gDoOnSelectTree = true;
 var gUpdateTreeValue = true;
 
 /** ************ INITIALISATION && SETUP **************/
@@ -49,35 +49,51 @@ function Startup() {
   // who only needs to know if OK was clicked
   window.opener.AdvancedEditOK = false;
 
   // The actual element edited (not a copy!)
   gElement = window.arguments[1];
 
   // place the tag name in the header
   var tagLabel = document.getElementById("tagLabel");
-  tagLabel.setAttribute("value", ("<" + gElement.localName + ">"));
+  tagLabel.setAttribute("value", "<" + gElement.localName + ">");
 
   // Create dialog object to store controls for easy access
-  gDialog.AddHTMLAttributeNameInput  = document.getElementById("AddHTMLAttributeNameInput");
+  gDialog.AddHTMLAttributeNameInput = document.getElementById(
+    "AddHTMLAttributeNameInput"
+  );
 
   // We use a <deck> to switch between editable menulist and textbox
-  gDialog.AddHTMLAttributeValueDeck     = document.getElementById("AddHTMLAttributeValueDeck");
-  gDialog.AddHTMLAttributeValueMenulist = document.getElementById("AddHTMLAttributeValueMenulist");
-  gDialog.AddHTMLAttributeValueTextbox  = document.getElementById("AddHTMLAttributeValueTextbox");
-  gDialog.AddHTMLAttributeValueInput    = gDialog.AddHTMLAttributeValueTextbox;
+  gDialog.AddHTMLAttributeValueDeck = document.getElementById(
+    "AddHTMLAttributeValueDeck"
+  );
+  gDialog.AddHTMLAttributeValueMenulist = document.getElementById(
+    "AddHTMLAttributeValueMenulist"
+  );
+  gDialog.AddHTMLAttributeValueTextbox = document.getElementById(
+    "AddHTMLAttributeValueTextbox"
+  );
+  gDialog.AddHTMLAttributeValueInput = gDialog.AddHTMLAttributeValueTextbox;
 
-  gDialog.AddHTMLAttributeTree          = document.getElementById("HTMLATree");
-  gDialog.AddCSSAttributeNameInput      = document.getElementById("AddCSSAttributeNameInput");
-  gDialog.AddCSSAttributeValueInput     = document.getElementById("AddCSSAttributeValueInput");
-  gDialog.AddCSSAttributeTree           = document.getElementById("CSSATree");
-  gDialog.AddJSEAttributeNameList       = document.getElementById("AddJSEAttributeNameList");
-  gDialog.AddJSEAttributeValueInput     = document.getElementById("AddJSEAttributeValueInput");
-  gDialog.AddJSEAttributeTree           = document.getElementById("JSEATree");
-  gDialog.okButton                      = document.documentElement.getButton("accept");
+  gDialog.AddHTMLAttributeTree = document.getElementById("HTMLATree");
+  gDialog.AddCSSAttributeNameInput = document.getElementById(
+    "AddCSSAttributeNameInput"
+  );
+  gDialog.AddCSSAttributeValueInput = document.getElementById(
+    "AddCSSAttributeValueInput"
+  );
+  gDialog.AddCSSAttributeTree = document.getElementById("CSSATree");
+  gDialog.AddJSEAttributeNameList = document.getElementById(
+    "AddJSEAttributeNameList"
+  );
+  gDialog.AddJSEAttributeValueInput = document.getElementById(
+    "AddJSEAttributeValueInput"
+  );
+  gDialog.AddJSEAttributeTree = document.getElementById("JSEATree");
+  gDialog.okButton = document.documentElement.getButton("accept");
 
   // build the attribute trees
   BuildHTMLAttributeTable();
   BuildCSSAttributeTable();
   BuildJSEAttributeTable();
 
   // Build attribute name arrays for menulists
   BuildJSEAttributeNameList();
@@ -117,59 +133,63 @@ function onAccept() {
 }
 
 // Helpers for removing and setting attributes
 // Use editor transactions if modifying the element already in the document
 // (Temporary element from a property dialog won't have a parent node)
 function doRemoveAttribute(attrib) {
   try {
     var editor = GetCurrentEditor();
-    if (gElement.parentNode)
+    if (gElement.parentNode) {
       editor.removeAttribute(gElement, attrib);
-    else
+    } else {
       gElement.removeAttribute(attrib);
+    }
   } catch (ex) {}
 }
 
 function doSetAttribute(attrib, value) {
   try {
     var editor = GetCurrentEditor();
-    if (gElement.parentNode)
+    if (gElement.parentNode) {
       editor.setAttribute(gElement, attrib, value);
-    else
+    } else {
       gElement.setAttribute(attrib, value);
+    }
   } catch (ex) {}
 }
 
 /**
  * function   : bool CheckAttributeNameSimilarity ( string attName, array attArray );
  * parameters : attribute to look for, array of current attributes
  * returns    : true if attribute already exists, false if it does not
  * desc.      : checks to see if any other attributes by the same name as the arg supplied
  *              already exist.
  **/
 function CheckAttributeNameSimilarity(attName, attArray) {
   for (var i = 0; i < attArray.length; i++) {
-    if (attName.toLowerCase() == attArray[i].toLowerCase())
+    if (attName.toLowerCase() == attArray[i].toLowerCase()) {
       return true;
+    }
   }
   return false;
 }
 
 /**
  * function   : bool UpdateExistingAttribute ( string attName, string attValue, string treeChildrenId );
  * parameters : attribute to look for, new value, ID of <treeChildren> node in XUL tree
  * returns    : true if attribute already exists in tree, false if it does not
  * desc.      : checks to see if any other attributes by the same name as the arg supplied
  *              already exist while setting the associated value if different from current value
  **/
 function UpdateExistingAttribute(attName, attValue, treeChildrenId) {
   var treeChildren = document.getElementById(treeChildrenId);
-  if (!treeChildren)
+  if (!treeChildren) {
     return false;
+  }
 
   var name;
   var i;
   attName = TrimString(attName).toLowerCase();
   attValue = TrimString(attValue);
 
   for (i = 0; i < treeChildren.childNodes.length; i++) {
     var item = treeChildren.childNodes[i];
@@ -193,18 +213,19 @@ function UpdateExistingAttribute(attName
 }
 
 /**
  * function   : string GetAndSelectExistingAttributeValue ( string attName, string treeChildrenId );
  * parameters : attribute to look for, ID of <treeChildren> node in XUL tree
  * returns    : value in from the tree or empty string if name not found
  **/
 function GetAndSelectExistingAttributeValue(attName, treeChildrenId) {
-  if (!attName)
+  if (!attName) {
     return "";
+  }
 
   var treeChildren = document.getElementById(treeChildrenId);
   var name;
   var i;
 
   for (i = 0; i < treeChildren.childNodes.length; i++) {
     var item = treeChildren.childNodes[i];
     name = GetTreeItemAttributeStr(item);
@@ -234,37 +255,41 @@ function GetAndSelectExistingAttributeVa
 
 /* Tree structure:
   <treeItem>
     <treeRow>
       <treeCell> // Name Cell
       <treeCell  // Value Cell
 */
 function GetTreeItemAttributeStr(treeItem) {
-  if (treeItem)
+  if (treeItem) {
     return TrimString(treeItem.firstChild.firstChild.getAttribute("label"));
+  }
 
   return "";
 }
 
 function GetTreeItemValueStr(treeItem) {
-  if (treeItem)
+  if (treeItem) {
     return TrimString(treeItem.firstChild.lastChild.getAttribute("label"));
+  }
 
   return "";
 }
 
 function SetTreeItemValueStr(treeItem, value) {
-  if (treeItem && GetTreeItemValueStr(treeItem) != value)
+  if (treeItem && GetTreeItemValueStr(treeItem) != value) {
     treeItem.firstChild.lastChild.setAttribute("label", value);
+  }
 }
 
 function IsNotTreeHeader(treeCell) {
-  if (treeCell)
-    return (treeCell.parentNode.parentNode.nodeName != "treehead");
+  if (treeCell) {
+    return treeCell.parentNode.parentNode.nodeName != "treehead";
+  }
 
   return false;
 }
 
 function RemoveNameFromAttArray(attName, attArray) {
   for (var i = 0; i < attArray.length; i++) {
     if (attName.toLowerCase() == attArray[i].toLowerCase()) {
       // Remove 1 array item
@@ -305,12 +330,13 @@ function AddTreeItem(name, value, treeCh
 }
 
 function selectTreeItem(treeChildren, item) {
   var index = treeChildren.parentNode.view.getIndexOfItem(item);
   treeChildren.parentNode.view.selection.select(index);
 }
 
 function getSelectedItem(tree) {
-  if (tree.view.selection.count == 1)
+  if (tree.view.selection.count == 1) {
     return tree.view.getItemAtIndex(tree.currentIndex);
+  }
   return null;
 }
--- a/editor/ui/dialogs/content/EdButtonProps.js
+++ b/editor/ui/dialogs/content/EdButtonProps.js
@@ -16,25 +16,25 @@ document.addEventListener("dialogcancel"
 function Startup() {
   var editor = GetCurrentEditor();
   if (!editor) {
     window.close();
     return;
   }
 
   gDialog = {
-    buttonType:       document.getElementById("ButtonType"),
-    buttonName:       document.getElementById("ButtonName"),
-    buttonValue:      document.getElementById("ButtonValue"),
-    buttonDisabled:   document.getElementById("ButtonDisabled"),
-    buttonTabIndex:   document.getElementById("ButtonTabIndex"),
-    buttonAccessKey:  document.getElementById("ButtonAccessKey"),
-    MoreSection:      document.getElementById("MoreSection"),
-    MoreFewerButton:  document.getElementById("MoreFewerButton"),
-    RemoveButton:     document.getElementById("RemoveButton"),
+    buttonType: document.getElementById("ButtonType"),
+    buttonName: document.getElementById("ButtonName"),
+    buttonValue: document.getElementById("ButtonValue"),
+    buttonDisabled: document.getElementById("ButtonDisabled"),
+    buttonTabIndex: document.getElementById("ButtonTabIndex"),
+    buttonAccessKey: document.getElementById("ButtonAccessKey"),
+    MoreSection: document.getElementById("MoreSection"),
+    MoreFewerButton: document.getElementById("MoreFewerButton"),
+    RemoveButton: document.getElementById("RemoveButton"),
   };
 
   // Get a single selected button element
   const kTagName = "button";
   try {
     buttonElement = editor.getSelectedElement(kTagName);
   } catch (e) {}
 
@@ -80,17 +80,20 @@ function InitDialog() {
       break;
     case "reset":
       index = 1;
       break;
   }
   gDialog.buttonType.selectedIndex = index;
   gDialog.buttonName.value = globalElement.getAttribute("name");
   gDialog.buttonValue.value = globalElement.getAttribute("value");
-  gDialog.buttonDisabled.setAttribute("checked", globalElement.hasAttribute("disabled"));
+  gDialog.buttonDisabled.setAttribute(
+    "checked",
+    globalElement.hasAttribute("disabled")
+  );
   gDialog.buttonTabIndex.value = globalElement.getAttribute("tabindex");
   gDialog.buttonAccessKey.value = globalElement.getAttribute("accesskey");
 }
 
 function RemoveButton() {
   RemoveContainer(buttonElement);
   SaveWindowLocation();
   window.close();
@@ -100,40 +103,44 @@ function ValidateData() {
   var attributes = {
     type: ["", "reset", "button"][gDialog.buttonType.selectedIndex],
     name: gDialog.buttonName.value,
     value: gDialog.buttonValue.value,
     tabindex: gDialog.buttonTabIndex.value,
     accesskey: gDialog.buttonAccessKey.value,
   };
   for (var a in attributes) {
-    if (attributes[a])
+    if (attributes[a]) {
       globalElement.setAttribute(a, attributes[a]);
-    else
+    } else {
       globalElement.removeAttribute(a);
+    }
   }
-  if (gDialog.buttonDisabled.checked)
+  if (gDialog.buttonDisabled.checked) {
     globalElement.setAttribute("disabled", "");
-  else
+  } else {
     globalElement.removeAttribute("disabled");
+  }
   return true;
 }
 
 function onAccept() {
   // All values are valid - copy to actual element in doc or
   //   element created to insert
   ValidateData();
 
   var editor = GetCurrentEditor();
 
   editor.cloneAttributes(buttonElement, globalElement);
 
   if (insertNew) {
     if (!InsertElementAroundSelection(buttonElement)) {
       /* eslint-disable-next-line no-unsanitized/property */
-      buttonElement.innerHTML = editor.outputToString("text/html", kOutputSelectionOnly);
+      buttonElement.innerHTML = editor.outputToString(
+        "text/html",
+        kOutputSelectionOnly
+      );
       editor.insertElementAtSelection(buttonElement, true);
     }
   }
 
   SaveWindowLocation();
 }
-
--- a/editor/ui/dialogs/content/EdColorPicker.js
+++ b/editor/ui/dialogs/content/EdColorPicker.js
@@ -29,60 +29,64 @@ function Startup() {
     dump("EdColorPicker: Missing color object param\n");
     return;
   }
 
   // window.arguments[1] is object to get initial values and return color data
   gColorObj = window.arguments[1];
   gColorObj.Cancel = false;
 
-  gDialog.ColorPicker      = document.getElementById("ColorPicker");
-  gDialog.ColorInput       = document.getElementById("ColorInput");
+  gDialog.ColorPicker = document.getElementById("ColorPicker");
+  gDialog.ColorInput = document.getElementById("ColorInput");
   gDialog.LastPickedButton = document.getElementById("LastPickedButton");
-  gDialog.LastPickedColor  = document.getElementById("LastPickedColor");
+  gDialog.LastPickedColor = document.getElementById("LastPickedColor");
   gDialog.CellOrTableGroup = document.getElementById("CellOrTableGroup");
-  gDialog.TableRadio       = document.getElementById("TableRadio");
-  gDialog.CellRadio        = document.getElementById("CellRadio");
-  gDialog.ColorSwatch      = document.getElementById("ColorPickerSwatch");
-  gDialog.Ok               = document.documentElement.getButton("accept");
+  gDialog.TableRadio = document.getElementById("TableRadio");
+  gDialog.CellRadio = document.getElementById("CellRadio");
+  gDialog.ColorSwatch = document.getElementById("ColorPickerSwatch");
+  gDialog.Ok = document.documentElement.getButton("accept");
 
   // The type of color we are setting:
   //  text: Text, Link, ActiveLink, VisitedLink,
   //  or background: Page, Table, or Cell
   if (gColorObj.Type) {
     ColorType = gColorObj.Type;
     // Get string for dialog title from passed-in type
     //   (note constraint on editor.properties string name)
     let IsCSSPrefChecked = Services.prefs.getBoolPref("editor.use_css");
 
     if (GetCurrentEditor()) {
-      if (ColorType == "Page" && IsCSSPrefChecked && IsHTMLEditor())
+      if (ColorType == "Page" && IsCSSPrefChecked && IsHTMLEditor()) {
         document.title = GetString("BlockColor");
-      else
+      } else {
         document.title = GetString(ColorType + "Color");
+      }
     }
   }
 
   gDialog.ColorInput.value = "";
   var tmpColor;
   var haveTableRadio = false;
 
   switch (ColorType) {
     case "Page":
       tmpColor = gColorObj.PageColor;
-      if (tmpColor && tmpColor.toLowerCase() != "window")
+      if (tmpColor && tmpColor.toLowerCase() != "window") {
         gColor = tmpColor;
+      }
       break;
     case "Table":
-      if (gColorObj.TableColor)
+      if (gColorObj.TableColor) {
         gColor = gColorObj.TableColor;
+      }
       break;
     case "Cell":
-      if (gColorObj.CellColor)
+      if (gColorObj.CellColor) {
         gColor = gColorObj.CellColor;
+      }
       break;
     case "TableOrCell":
       TableOrCell = true;
       document.getElementById("TableOrCellGroup").collapsed = false;
       haveTableRadio = true;
       if (gColorObj.SelectedType == "Cell") {
         gColor = gColorObj.CellColor;
         gDialog.CellOrTableGroup.selectedItem = gDialog.CellRadio;
@@ -90,80 +94,99 @@ function Startup() {
       } else {
         gColor = gColorObj.TableColor;
         gDialog.CellOrTableGroup.selectedItem = gDialog.TableRadio;
         gDialog.TableRadio.focus();
       }
       break;
     case "Highlight":
       HighlightType = true;
-      if (gColorObj.HighlightColor)
+      if (gColorObj.HighlightColor) {
         gColor = gColorObj.HighlightColor;
+      }
       break;
     default:
       // Any other type will change some kind of text,
       TextType = true;
       tmpColor = gColorObj.TextColor;
-      if (tmpColor && tmpColor.toLowerCase() != "windowtext")
+      if (tmpColor && tmpColor.toLowerCase() != "windowtext") {
         gColor = gColorObj.TextColor;
+      }
       break;
   }
 
   // Set initial color in input field and in the colorpicker
   SetCurrentColor(gColor);
   gDialog.ColorPicker.value = gColor;
 
   // Use last-picked colors passed in, or those persistent on dialog
   if (TextType) {
-    if (!("LastTextColor" in gColorObj) || !gColorObj.LastTextColor)
-      gColorObj.LastTextColor = gDialog.LastPickedColor.getAttribute("LastTextColor");
+    if (!("LastTextColor" in gColorObj) || !gColorObj.LastTextColor) {
+      gColorObj.LastTextColor = gDialog.LastPickedColor.getAttribute(
+        "LastTextColor"
+      );
+    }
     LastPickedColor = gColorObj.LastTextColor;
   } else if (HighlightType) {
-    if (!("LastHighlightColor" in gColorObj) || !gColorObj.LastHighlightColor)
-      gColorObj.LastHighlightColor = gDialog.LastPickedColor.getAttribute("LastHighlightColor");
+    if (!("LastHighlightColor" in gColorObj) || !gColorObj.LastHighlightColor) {
+      gColorObj.LastHighlightColor = gDialog.LastPickedColor.getAttribute(
+        "LastHighlightColor"
+      );
+    }
     LastPickedColor = gColorObj.LastHighlightColor;
   } else {
-    if (!("LastBackgroundColor" in gColorObj) || !gColorObj.LastBackgroundColor)
-      gColorObj.LastBackgroundColor = gDialog.LastPickedColor.getAttribute("LastBackgroundColor");
+    if (
+      !("LastBackgroundColor" in gColorObj) ||
+      !gColorObj.LastBackgroundColor
+    ) {
+      gColorObj.LastBackgroundColor = gDialog.LastPickedColor.getAttribute(
+        "LastBackgroundColor"
+      );
+    }
     LastPickedColor = gColorObj.LastBackgroundColor;
   }
 
   // Set method to detect clicking on OK button
   //  so we don't get fooled by changing "default" behavior
   gDialog.Ok.setAttribute("onclick", "SetDefaultToOk()");
 
   if (!LastPickedColor) {
     // Hide the button, as there is no last color available.
     gDialog.LastPickedButton.hidden = true;
   } else {
-    gDialog.LastPickedColor.setAttribute("style", "background-color: " + LastPickedColor);
+    gDialog.LastPickedColor.setAttribute(
+      "style",
+      "background-color: " + LastPickedColor
+    );
 
     // Make "Last-picked" the default button, until the user selects a color.
     gDialog.Ok.removeAttribute("default");
     gDialog.LastPickedButton.setAttribute("default", "true");
   }
 
   // Caller can prevent user from submitting an empty, i.e., default color
   NoDefault = gColorObj.NoDefault;
   if (NoDefault) {
     // Hide the "Default button -- user must pick a color
     document.getElementById("DefaultColorButton").collapsed = true;
   }
 
   // Set focus to colorpicker if not set to table radio buttons above
-  if (!haveTableRadio)
+  if (!haveTableRadio) {
     gDialog.ColorPicker.focus();
+  }
 
   SetWindowLocation();
 }
 
 function SelectColor() {
   var color = gDialog.ColorPicker.value;
-  if (color)
+  if (color) {
     SetCurrentColor(color);
+  }
 }
 
 function RemoveColor() {
   SetCurrentColor("");
   gDialog.ColorInput.focus();
   SetDefaultToOk();
 }
 
@@ -171,56 +194,61 @@ function SelectColorByKeypress(aEvent) {
   if (aEvent.charCode == aEvent.DOM_VK_SPACE) {
     SelectColor();
     SetDefaultToOk();
   }
 }
 
 function SelectLastPickedColor() {
   SetCurrentColor(LastPickedColor);
-  if (onAccept())
+  if (onAccept()) {
     // window.close();
     return true;
+  }
 
   return false;
 }
 
 function SetCurrentColor(color) {
   // TODO: Validate color?
-  if (!color) color = "";
+  if (!color) {
+    color = "";
+  }
   gColor = TrimString(color).toLowerCase();
-  if (gColor == "mixed")
+  if (gColor == "mixed") {
     gColor = "";
+  }
   gDialog.ColorInput.value = gColor;
   SetColorSwatch();
 }
 
 function SetColorSwatch() {
   // TODO: DON'T ALLOW SPACES?
   var color = TrimString(gDialog.ColorInput.value);
   if (color) {
-    gDialog.ColorSwatch.setAttribute("style", ("background-color:" + color));
+    gDialog.ColorSwatch.setAttribute("style", "background-color:" + color);
     gDialog.ColorSwatch.removeAttribute("default");
   } else {
-    gDialog.ColorSwatch.setAttribute("style", ("background-color:inherit"));
+    gDialog.ColorSwatch.setAttribute("style", "background-color:inherit");
     gDialog.ColorSwatch.setAttribute("default", "true");
   }
 }
 
 function SetDefaultToOk() {
   gDialog.LastPickedButton.removeAttribute("default");
   gDialog.Ok.setAttribute("default", "true");
   LastPickedIsDefault = false;
 }
 
 function ValidateData() {
-  if (LastPickedIsDefault)
+  if (LastPickedIsDefault) {
     gColor = LastPickedColor;
-  else
+  } else {
     gColor = gDialog.ColorInput.value;
+  }
 
   gColor = TrimString(gColor).toLowerCase();
 
   // TODO: Validate the color string!
 
   if (NoDefault && !gColor) {
     ShowInputErrorMessage(GetString("NoColorError"));
     SetTextboxFocus(gDialog.ColorInput);
@@ -250,18 +278,19 @@ function onAccept(event) {
     }
   } else {
     gColorObj.BackgroundColor = gColor;
     if (gColor.length > 0) {
       gDialog.LastPickedColor.setAttribute("LastBackgroundColor", gColor);
       gColorObj.LastBackgroundColor = gColor;
     }
     // If table or cell requested, tell caller which element to set on
-    if (TableOrCell && gDialog.TableRadio.selected)
+    if (TableOrCell && gDialog.TableRadio.selected) {
       gColorObj.Type = "Table";
+    }
   }
   SaveWindowLocation();
 }
 
 function onCancelColor() {
   // Tells caller that user canceled
   gColorObj.Cancel = true;
   SaveWindowLocation();
--- a/editor/ui/dialogs/content/EdColorProps.js
+++ b/editor/ui/dialogs/content/EdColorProps.js
@@ -25,27 +25,27 @@ var prefs;
 var gBackgroundImage;
 
 // Initialize in case we can't get them from prefs???
 var defaultTextColor = "#000000";
 var defaultLinkColor = "#000099";
 var defaultActiveColor = "#000099";
 var defaultVisitedColor = "#990099";
 var defaultBackgroundColor = "#FFFFFF";
-const styleStr =       "style";
-const textStr =        "text";
-const linkStr =        "link";
-const vlinkStr =       "vlink";
-const alinkStr =       "alink";
-const bgcolorStr =     "bgcolor";
-const backgroundStr =  "background";
+const styleStr = "style";
+const textStr = "text";
+const linkStr = "link";
+const vlinkStr = "vlink";
+const alinkStr = "alink";
+const bgcolorStr = "bgcolor";
+const backgroundStr = "background";
 const cssColorStr = "color";
 const cssBackgroundColorStr = "background-color";
 const cssBackgroundImageStr = "background-image";
-const colorStyle =     cssColorStr + ": ";
+const colorStyle = cssColorStr + ": ";
 const backColorStyle = cssBackgroundColorStr + ": ";
 const backImageStyle = "; " + cssBackgroundImageStr + ": url(";
 
 var customTextColor;
 var customLinkColor;
 var customActiveColor;
 var customVisitedColor;
 var customBackgroundColor;
@@ -62,17 +62,19 @@ function Startup() {
   gDialog.ColorPreview = document.getElementById("ColorPreview");
   gDialog.NormalText = document.getElementById("NormalText");
   gDialog.LinkText = document.getElementById("LinkText");
   gDialog.ActiveLinkText = document.getElementById("ActiveLinkText");
   gDialog.VisitedLinkText = document.getElementById("VisitedLinkText");
   gDialog.PageColorGroup = document.getElementById("PageColorGroup");
   gDialog.DefaultColorsRadio = document.getElementById("DefaultColorsRadio");
   gDialog.CustomColorsRadio = document.getElementById("CustomColorsRadio");
-  gDialog.BackgroundImageInput = document.getElementById("BackgroundImageInput");
+  gDialog.BackgroundImageInput = document.getElementById(
+    "BackgroundImageInput"
+  );
 
   try {
     gBodyElement = editor.rootElement;
   } catch (e) {}
 
   if (!gBodyElement) {
     dump("Failed to get BODY element!\n");
     window.close();
@@ -83,89 +85,121 @@ function Startup() {
 
   // Initialize default colors from browser prefs
   var browserColors = GetDefaultBrowserColors();
   if (browserColors) {
     // Use author's browser pref colors passed into dialog
     defaultTextColor = browserColors.TextColor;
     defaultLinkColor = browserColors.LinkColor;
     defaultActiveColor = browserColors.ActiveLinkColor;
-    defaultVisitedColor =  browserColors.VisitedLinkColor;
-    defaultBackgroundColor =  browserColors.BackgroundColor;
+    defaultVisitedColor = browserColors.VisitedLinkColor;
+    defaultBackgroundColor = browserColors.BackgroundColor;
   }
 
   // We only need to test for this once per dialog load
   gHaveDocumentUrl = GetDocumentBaseUrl();
 
   InitDialog();
 
   gDialog.PageColorGroup.focus();
 
   SetWindowLocation();
 }
 
 function InitDialog() {
   // Get image from document
-  gBackgroundImage = GetHTMLOrCSSStyleValue(globalElement, backgroundStr, cssBackgroundImageStr);
-  if (/url\((.*)\)/.test(gBackgroundImage))
+  gBackgroundImage = GetHTMLOrCSSStyleValue(
+    globalElement,
+    backgroundStr,
+    cssBackgroundImageStr
+  );
+  if (/url\((.*)\)/.test(gBackgroundImage)) {
     gBackgroundImage = RegExp.$1;
+  }
 
   if (gBackgroundImage) {
     // Shorten data URIs for display.
     shortenImageData(gBackgroundImage, gDialog.BackgroundImageInput);
-    gDialog.ColorPreview.setAttribute(styleStr, backImageStyle + gBackgroundImage + ");");
+    gDialog.ColorPreview.setAttribute(
+      styleStr,
+      backImageStyle + gBackgroundImage + ");"
+    );
   }
 
   SetRelativeCheckbox();
 
-  customTextColor        = GetHTMLOrCSSStyleValue(globalElement, textStr, cssColorStr);
-  customTextColor        = ConvertRGBColorIntoHEXColor(customTextColor);
-  customLinkColor        = globalElement.getAttribute(linkStr);
-  customActiveColor      = globalElement.getAttribute(alinkStr);
-  customVisitedColor     = globalElement.getAttribute(vlinkStr);
-  customBackgroundColor  = GetHTMLOrCSSStyleValue(globalElement, bgcolorStr, cssBackgroundColorStr);
-  customBackgroundColor  = ConvertRGBColorIntoHEXColor(customBackgroundColor);
+  customTextColor = GetHTMLOrCSSStyleValue(globalElement, textStr, cssColorStr);
+  customTextColor = ConvertRGBColorIntoHEXColor(customTextColor);
+  customLinkColor = globalElement.getAttribute(linkStr);
+  customActiveColor = globalElement.getAttribute(alinkStr);
+  customVisitedColor = globalElement.getAttribute(vlinkStr);
+  customBackgroundColor = GetHTMLOrCSSStyleValue(
+    globalElement,
+    bgcolorStr,
+    cssBackgroundColorStr
+  );
+  customBackgroundColor = ConvertRGBColorIntoHEXColor(customBackgroundColor);
 
   var haveCustomColor =
-        customTextColor ||
-        customLinkColor ||
-        customVisitedColor ||
-        customActiveColor ||
-        customBackgroundColor;
+    customTextColor ||
+    customLinkColor ||
+    customVisitedColor ||
+    customActiveColor ||
+    customBackgroundColor;
 
   // Set default color explicitly for any that are missing
   // PROBLEM: We are using "windowtext" and "window" for the Windows OS
   //   default color values. This works with CSS in preview window,
   //   but we should NOT use these as values for HTML attributes!
 
-  if (!customTextColor) customTextColor = defaultTextColor;
-  if (!customLinkColor) customLinkColor = defaultLinkColor;
-  if (!customActiveColor) customActiveColor = defaultActiveColor;
-  if (!customVisitedColor) customVisitedColor = defaultVisitedColor;
-  if (!customBackgroundColor) customBackgroundColor = defaultBackgroundColor;
+  if (!customTextColor) {
+    customTextColor = defaultTextColor;
+  }
+  if (!customLinkColor) {
+    customLinkColor = defaultLinkColor;
+  }
+  if (!customActiveColor) {
+    customActiveColor = defaultActiveColor;
+  }
+  if (!customVisitedColor) {
+    customVisitedColor = defaultVisitedColor;
+  }
+  if (!customBackgroundColor) {
+    customBackgroundColor = defaultBackgroundColor;
+  }
 
   if (haveCustomColor) {
     // If any colors are set, then check the "Custom" radio button
     gDialog.PageColorGroup.selectedItem = gDialog.CustomColorsRadio;
     UseCustomColors();
   } else {
     gDialog.PageColorGroup.selectedItem = gDialog.DefaultColorsRadio;
     UseDefaultColors();
   }
 }
 
 function GetColorAndUpdate(ColorWellID) {
   // Only allow selecting when in custom mode
-  if (!gDialog.CustomColorsRadio.selected) return;
+  if (!gDialog.CustomColorsRadio.selected) {
+    return;
+  }
 
   var colorWell = document.getElementById(ColorWellID);
-  if (!colorWell) return;
+  if (!colorWell) {
+    return;
+  }
 
   // Don't allow a blank color, i.e., using the "default"
-  var colorObj = { NoDefault: true, Type: "", TextColor: 0, PageColor: 0, Cancel: false };
+  var colorObj = {
+    NoDefault: true,
+    Type: "",
+    TextColor: 0,
+    PageColor: 0,
+    Cancel: false,
+  };
 
   switch (ColorWellID) {
     case "textCW":
       colorObj.Type = "Text";
       colorObj.TextColor = customTextColor;
       break;
     case "linkCW":
       colorObj.Type = "Link";
@@ -180,21 +214,28 @@ function GetColorAndUpdate(ColorWellID) 
       colorObj.TextColor = customVisitedColor;
       break;
     case "backgroundCW":
       colorObj.Type = "Page";
       colorObj.PageColor = customBackgroundColor;
       break;
   }
 
-  window.openDialog("chrome://editor/content/EdColorPicker.xul", "_blank", "chrome,close,titlebar,modal", "", colorObj);
+  window.openDialog(
+    "chrome://editor/content/EdColorPicker.xul",
+    "_blank",
+    "chrome,close,titlebar,modal",
+    "",
+    colorObj
+  );
 
   // User canceled the dialog
-  if (colorObj.Cancel)
+  if (colorObj.Cancel) {
     return;
+  }
 
   var color = "";
   switch (ColorWellID) {
     case "textCW":
       color = customTextColor = colorObj.TextColor;
       break;
     case "linkCW":
       color = customLinkColor = colorObj.TextColor;
@@ -226,18 +267,19 @@ function SetColorPreview(ColorWellID, co
       gDialog.ActiveLinkText.setAttribute(styleStr, colorStyle + color);
       break;
     case "visitedCW":
       gDialog.VisitedLinkText.setAttribute(styleStr, colorStyle + color);
       break;
     case "backgroundCW":
       // Must combine background color and image style values
       var styleValue = backColorStyle + color;
-      if (gBackgroundImage)
+      if (gBackgroundImage) {
         styleValue += ";" + backImageStyle + gBackgroundImage + ");";
+      }
 
       gDialog.ColorPreview.setAttribute(styleStr, styleValue);
       previewBGColor = color;
       break;
   }
 }
 
 function UseCustomColors() {
@@ -291,18 +333,19 @@ function UseDefaultColors() {
   SetElementEnabledById("Visited", false);
   SetElementEnabledById("Background", false);
 }
 
 function chooseFile() {
   // Get a local image file, converted into URL format
   GetLocalFileURL("img").then(fileURL => {
     // Always try to relativize local file URLs
-    if (gHaveDocumentUrl)
+    if (gHaveDocumentUrl) {
       fileURL = MakeRelativeUrl(fileURL);
+    }
 
     gDialog.BackgroundImageInput.value = fileURL;
 
     SetRelativeCheckbox();
     ValidateAndPreviewImage(true);
     SetTextboxFocus(gDialog.BackgroundImageInput);
   });
 }
@@ -350,50 +393,63 @@ function ValidateData() {
       globalElement.removeAttribute(vlinkStr);
       globalElement.removeAttribute(alinkStr);
       editor.removeAttributeOrEquivalent(globalElement, bgcolorStr, true);
     } else {
       // Do NOT accept the CSS "WindowsOS" color strings!
       // Problem: We really should try to get the actual color values
       //  from windows, but I don't know how to do that!
       var tmpColor = customTextColor.toLowerCase();
-      if (tmpColor != "windowtext")
-        editor.setAttributeOrEquivalent(globalElement, textStr,
-                                        customTextColor, true);
-      else
+      if (tmpColor != "windowtext") {
+        editor.setAttributeOrEquivalent(
+          globalElement,
+          textStr,
+          customTextColor,
+          true
+        );
+      } else {
         editor.removeAttributeOrEquivalent(globalElement, textStr, true);
+      }
 
       tmpColor = customBackgroundColor.toLowerCase();
-      if (tmpColor != "window")
-        editor.setAttributeOrEquivalent(globalElement, bgcolorStr, customBackgroundColor, true);
-      else
+      if (tmpColor != "window") {
+        editor.setAttributeOrEquivalent(
+          globalElement,
+          bgcolorStr,
+          customBackgroundColor,
+          true
+        );
+      } else {
         editor.removeAttributeOrEquivalent(globalElement, bgcolorStr, true);
+      }
 
       globalElement.setAttribute(linkStr, customLinkColor);
       globalElement.setAttribute(vlinkStr, customVisitedColor);
       globalElement.setAttribute(alinkStr, customActiveColor);
     }
 
     if (ValidateAndPreviewImage(true)) {
       // A valid image may be null for no image
-      if (gBackgroundImage)
+      if (gBackgroundImage) {
         globalElement.setAttribute(backgroundStr, gBackgroundImage);
-      else
+      } else {
         editor.removeAttributeOrEquivalent(globalElement, backgroundStr, true);
+      }
 
       return true;
     }
   } catch (e) {}
   return false;
 }
 
 function onAccept(event) {
   // If it's a file, convert to a data URL.
   if (gBackgroundImage && /^file:/i.test(gBackgroundImage)) {
-    let nsFile = Services.io.newURI(gBackgroundImage)
+    let nsFile = Services.io
+      .newURI(gBackgroundImage)
       .QueryInterface(Ci.nsIFileURL).file;
     if (nsFile.exists()) {
       let reader = new FileReader();
       reader.addEventListener("load", function() {
         gBackgroundImage = reader.result;
         gDialog.BackgroundImageInput.value = reader.result;
         if (onAccept(event)) {
           window.close();
--- a/editor/ui/dialogs/content/EdConvertToTable.js
+++ b/editor/ui/dialogs/content/EdConvertToTable.js
@@ -15,23 +15,25 @@ var gOtherIndex = "2";
 
 // dialog initialization code
 function Startup() {
   if (!GetCurrentEditor()) {
     window.close();
     return;
   }
 
-  gDialog.sepRadioGroup      = document.getElementById("SepRadioGroup");
-  gDialog.sepCharacterInput  = document.getElementById("SepCharacterInput");
+  gDialog.sepRadioGroup = document.getElementById("SepRadioGroup");
+  gDialog.sepCharacterInput = document.getElementById("SepCharacterInput");
   gDialog.deleteSepCharacter = document.getElementById("DeleteSepCharacter");
-  gDialog.collapseSpaces     = document.getElementById("CollapseSpaces");
+  gDialog.collapseSpaces = document.getElementById("CollapseSpaces");
 
   // We persist the user's separator character
-  gDialog.sepCharacterInput.value = gDialog.sepRadioGroup.getAttribute("character");
+  gDialog.sepCharacterInput.value = gDialog.sepRadioGroup.getAttribute(
+    "character"
+  );
 
   gIndex = gDialog.sepRadioGroup.getAttribute("index");
 
   switch (gIndex) {
     case gCommaIndex:
     default:
       gDialog.sepRadioGroup.selectedItem = document.getElementById("comma");
       break;
@@ -48,22 +50,24 @@ function Startup() {
 
   SetWindowLocation();
 }
 
 function InputSepCharacter() {
   var str = gDialog.sepCharacterInput.value;
 
   // Limit input to 1 character
-  if (str.length > 1)
+  if (str.length > 1) {
     str = str.slice(0, 1);
+  }
 
   // We can never allow tag or entity delimiters for separator character
-  if (str == "<" || str == ">" || str == "&" || str == ";" || str == " ")
+  if (str == "<" || str == ">" || str == "&" || str == ";" || str == " ") {
     str = "";
+  }
 
   gDialog.sepCharacterInput.value = str;
 }
 
 function SelectCharacter(radioGroupIndex) {
   gIndex = radioGroupIndex;
   SetElementEnabledById("SepCharacterInput", gIndex == gOtherIndex);
   SetElementEnabledById("CollapseSpaces", gIndex == gSpaceIndex);
@@ -82,17 +86,20 @@ function onAccept() {
     case gOtherIndex:
       sepCharacter = gDialog.sepCharacterInput.value.slice(0, 1);
       break;
   }
 
   var editor = GetCurrentEditor();
   var str;
   try {
-    str = editor.outputToString("text/html", kOutputLFLineBreak | kOutputSelectionOnly);
+    str = editor.outputToString(
+      "text/html",
+      kOutputLFLineBreak | kOutputSelectionOnly
+    );
   } catch (e) {}
   if (!str) {
     SaveWindowLocation();
     return;
   }
 
   // Replace nbsp with spaces:
   str = str.replace(/\u00a0/g, " ");
@@ -136,31 +143,34 @@ function onAccept() {
       end = str.indexOf(">", start + 1);
       if (end > start) {
         let tagContent = str.slice(start + 1, end).trim();
 
         if (/^ol|^ul|^dl/.test(tagContent)) {
           //  Replace list tag with <BR> to start new row
           //   at beginning of second or greater list tag
           str = str.slice(0, start) + listSeparator + str.slice(end + 1);
-          if (listSeparator == "")
+          if (listSeparator == "") {
             listSeparator = "<br>";
+          }
 
           // Reset for list item separation into cells
           listItemSeparator = "";
         } else if (/^li|^dt|^dd/.test(tagContent)) {
           // Start a new row if this is first item after the ending the last list
-          if (endList)
+          if (endList) {
             listItemSeparator = "<br>";
+          }
 
           // Start new cell at beginning of second or greater list items
           str = str.slice(0, start) + listItemSeparator + str.slice(end + 1);
 
-          if (endList || listItemSeparator == "")
+          if (endList || listItemSeparator == "") {
             listItemSeparator = sepCharacter;
+          }
 
           endList = false;
         } else {
           // Find end tags
           endList = /^\/ol|^\/ul|^\/dl/.test(tagContent);
           if (endList || /^\/li|^\/dt|^\/dd/.test(tagContent)) {
             // Strip out tag
             str = str.slice(0, start) + str.slice(end + 1);
@@ -187,27 +197,29 @@ function onAccept() {
     //  so include it at start of string to replace
     replaceString = sepCharacter;
   }
 
   replaceString += "<td>";
 
   if (sepCharacter.length > 0) {
     var tempStr = sepCharacter;
-    var regExpChars = ".!@#$%^&*-+[]{}()\|\\\/";
-    if (regExpChars.includes(sepCharacter))
+    var regExpChars = ".!@#$%^&*-+[]{}()|\\/";
+    if (regExpChars.includes(sepCharacter)) {
       tempStr = "\\" + sepCharacter;
+    }
 
     if (gIndex == gSpaceIndex) {
       // If checkbox is checked,
       //   one or more adjacent spaces are one separator
-      if (gDialog.collapseSpaces.checked)
-          tempStr = "\\s+";
-        else
-          tempStr = "\\s";
+      if (gDialog.collapseSpaces.checked) {
+        tempStr = "\\s+";
+      } else {
+        tempStr = "\\s";
+      }
     }
     var pattern = new RegExp(tempStr, "g");
     str = str.replace(pattern, replaceString);
   }
 
   // Put back tag contents that we removed above
   searchStart = 0;
   var stackIndex = 0;
@@ -222,17 +234,20 @@ function onAccept() {
   } while (start >= 0);
 
   // End table row and start another for each br or p
   str = str.replace(/\s*<br>\s*/g, "</tr>\n<tr><td>");
 
   // Add the table tags and the opening and closing tr/td tags
   // Default table attributes should be same as those used in nsHTMLEditor::CreateElementWithDefaults()
   // (Default width="100%" is used in EdInsertTable.js)
-  str = "<table border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"2\">\n<tr><td>" + str + "</tr>\n</table>\n";
+  str =
+    '<table border="1" width="100%" cellpadding="2" cellspacing="2">\n<tr><td>' +
+    str +
+    "</tr>\n</table>\n";
 
   editor.beginTransaction();
 
   // Delete the selection -- makes it easier to find where table will insert
   var nodeBeforeTable = null;
   var nodeAfterTable = null;
   try {
     editor.deleteSelection(editor.eNone, editor.eStrip);
@@ -240,65 +255,72 @@ function onAccept() {
     var anchorNodeBeforeInsert = editor.selection.anchorNode;
     var offset = editor.selection.anchorOffset;
     if (anchorNodeBeforeInsert.nodeType == Node.TEXT_NODE) {
       // Text was split. Table should be right after the first or before
       nodeBeforeTable = anchorNodeBeforeInsert.previousSibling;
       nodeAfterTable = anchorNodeBeforeInsert;
     } else {
       // Table should be inserted right after node pointed to by selection
-      if (offset > 0)
+      if (offset > 0) {
         nodeBeforeTable = anchorNodeBeforeInsert.childNodes.item(offset - 1);
+      }
 
       nodeAfterTable = anchorNodeBeforeInsert.childNodes.item(offset);
     }
 
     editor.insertHTML(str);
   } catch (e) {}
 
   var table = null;
   if (nodeAfterTable) {
     var previous = nodeAfterTable.previousSibling;
-    if (previous && previous.nodeName.toLowerCase() == "table")
+    if (previous && previous.nodeName.toLowerCase() == "table") {
       table = previous;
+    }
   }
   if (!table && nodeBeforeTable) {
     var next = nodeBeforeTable.nextSibling;
-    if (next && next.nodeName.toLowerCase() == "table")
+    if (next && next.nodeName.toLowerCase() == "table") {
       table = next;
+    }
   }
 
   if (table) {
     // Fixup table only if pref is set
     var firstRow;
     try {
-      if (Services.prefs.getBoolPref("editor.table.maintain_structure"))
+      if (Services.prefs.getBoolPref("editor.table.maintain_structure")) {
         editor.normalizeTable(table);
+      }
 
       firstRow = editor.getFirstRow(table);
     } catch (e) {}
 
     // Put caret in first cell
     if (firstRow) {
       var node2 = firstRow.firstChild;
       do {
-        if (node2.nodeName.toLowerCase() == "td" ||
-            node2.nodeName.toLowerCase() == "th") {
+        if (
+          node2.nodeName.toLowerCase() == "td" ||
+          node2.nodeName.toLowerCase() == "th"
+        ) {
           try {
             editor.selection.collapse(node2, 0);
           } catch (e) {}
           break;
         }
         node2 = node2.nextSibling;
       } while (node2);
     }
   }
 
   editor.endTransaction();
 
   // Save persisted attributes
   gDialog.sepRadioGroup.setAttribute("index", gIndex);
-  if (gIndex == gOtherIndex)
+  if (gIndex == gOtherIndex) {
     gDialog.sepRadioGroup.setAttribute("character", sepCharacter);
+  }
 
   SaveWindowLocation();
 }
 /* eslint-enable complexity */
--- a/editor/ui/dialogs/content/EdDialogCommon.js
+++ b/editor/ui/dialogs/content/EdDialogCommon.js
@@ -12,20 +12,20 @@ var gDialog = {};
 
 var gHaveDocumentUrl = false;
 var gValidationError = false;
 
 // Use for 'defaultIndex' param in InitPixelOrPercentMenulist
 const gPixel = 0;
 const gPercent = 1;
 
-const gMaxPixels  = 100000; // Used for image size, borders, spacing, and padding
+const gMaxPixels = 100000; // Used for image size, borders, spacing, and padding
 // Gecko code uses 1000 for maximum rowspan, colspan
 // Also, editing performance is really bad above this
-const gMaxRows    = 1000;
+const gMaxRows = 1000;
 const gMaxColumns = 1000;
 const gMaxTableSize = 1000000; // Width or height of table or cells
 
 // For dialogs that expand in size. Default is smaller size see "onMoreFewer()" below
 var SeeMore = false;
 
 // A XUL element with id="location" for managing
 // dialog location relative to parent window
@@ -51,55 +51,78 @@ var globalElement;
  *    If error, we also:
  *      Shift focus and select contents of the inputWidget,
  *      Switch to appropriate panel of tabbed dialog if user implements "SwitchToValidate()",
  *      and/or will expand the dialog to full size if "More / Fewer" feature is implemented
  *
  *  Returns the "value" as a string, or "" if error or input contents are empty
  *  The global "gValidationError" variable is set true if error was found
  */
-function ValidateNumber(inputWidget, listWidget, minVal, maxVal, element, attName, mustHaveValue, mustShowMoreSection) {
+function ValidateNumber(
+  inputWidget,
+  listWidget,
+  minVal,
+  maxVal,
+  element,
+  attName,
+  mustHaveValue,
+  mustShowMoreSection
+) {
   if (!inputWidget) {
     gValidationError = true;
     return "";
   }
 
   // Global error return value
   gValidationError = false;
   var maxLimit = maxVal;
   var isPercent = false;
 
   var numString = TrimString(inputWidget.value);
   if (numString || mustHaveValue) {
-    if (listWidget)
-      isPercent = (listWidget.selectedIndex == 1);
-    if (isPercent)
+    if (listWidget) {
+      isPercent = listWidget.selectedIndex == 1;
+    }
+    if (isPercent) {
       maxLimit = 100;
+    }
 
     // This method puts up the error message
     numString = ValidateNumberRange(numString, minVal, maxLimit, mustHaveValue);
     if (!numString) {
       // Switch to appropriate panel for error reporting
       SwitchToValidatePanel();
 
       // or expand dialog for users of "More / Fewer" button
-      if ("dialog" in window && window.dialog &&
-           "MoreSection" in gDialog && gDialog.MoreSection) {
-        if (!SeeMore)
+      if (
+        "dialog" in window &&
+        window.dialog &&
+        "MoreSection" in gDialog &&
+        gDialog.MoreSection
+      ) {
+        if (!SeeMore) {
           onMoreFewer();
+        }
       }
 
       // Error - shift to offending input widget
       SetTextboxFocus(inputWidget);
       gValidationError = true;
     } else {
-      if (isPercent)
+      if (isPercent) {
         numString += "%";
-      if (element)
-        GetCurrentEditor().setAttributeOrEquivalent(element, attName, numString, true);
+      }
+      if (element) {
+        GetCurrentEditor().setAttributeOrEquivalent(
+          element,
+          attName,
+          numString,
+          true
+        );
+      }
     }
   } else if (element) {
     GetCurrentEditor().removeAttributeOrEquivalent(element, attName, true);
   }
   return numString;
 }
 
 /* Validate contents of an input field
@@ -119,18 +142,19 @@ function ValidateNumber(inputWidget, lis
  *  The global "gValidationError" variable is set true if error was found
  */
 function ValidateNumberRange(value, minValue, maxValue, mustHaveValue) {
   // Initialize global error flag
   gValidationError = false;
   value = TrimString(String(value));
 
   // We don't show error for empty string unless caller wants to
-  if (!value && !mustHaveValue)
+  if (!value && !mustHaveValue) {
     return "";
+  }
 
   var numberStr = "";
 
   if (value.length > 0) {
     // Extract just numeric characters
     var number = Number(value.replace(/\D+/g, ""));
     if (number >= minValue && number <= maxValue) {
       // Return string version of the number
@@ -161,17 +185,24 @@ function ValidateNumberRange(value, minV
 function SetTextboxFocusById(id) {
   SetTextboxFocus(document.getElementById(id));
 }
 
 function SetTextboxFocus(textbox) {
   if (textbox) {
     // XXX Using the setTimeout is hacky workaround for bug 103197
     // Must create a new function to keep "textbox" in scope
-    setTimeout(function(textbox) { textbox.focus(); textbox.select(); }, 0, textbox);
+    setTimeout(
+      function(textbox) {
+        textbox.focus();
+        textbox.select();
+      },
+      0,
+      textbox
+    );
   }
 }
 
 function ShowInputErrorMessage(message) {
   Services.prompt.alert(window, GetString("InputError"), message);
   window.focus();
 }
 
@@ -179,117 +210,145 @@ function ShowInputErrorMessage(message) 
 //  to determine what a "%" value is referring to.
 // elementForAtt is element we are actually setting attributes on
 //  (a temporary copy of element in the doc to allow canceling),
 //  but elementInDoc is needed to find parent context in document
 function GetAppropriatePercentString(elementForAtt, elementInDoc) {
   var editor = GetCurrentEditor();
   try {
     var name = elementForAtt.nodeName.toLowerCase();
-    if (name == "td" || name == "th")
+    if (name == "td" || name == "th") {
       return GetString("PercentOfTable");
+    }
 
     // Check if element is within a table cell
-    if (editor.getElementOrParentByTagName("td", elementInDoc))
+    if (editor.getElementOrParentByTagName("td", elementInDoc)) {
       return GetString("PercentOfCell");
+    }
     return GetString("PercentOfWindow");
   } catch (e) {
     return "";
   }
 }
 
 function ClearListbox(listbox) {
   if (listbox) {
     listbox.clearSelection();
-    while (listbox.hasChildNodes())
+    while (listbox.hasChildNodes()) {
       listbox.lastChild.remove();
+    }
   }
 }
 
 function forceInteger(elementID) {