Bug 1691274 - Use DOM hidden property methods instead of attribute methods in browser/ directory. r=ntim,preferences-reviewers
authorjames <avikpaulsept2002@gmail.com>
Sat, 13 Feb 2021 23:33:51 +0000
changeset 567456 cf0c96111019105e11a5a65e1e2706bc0ec18813
parent 567455 4c29672b9a35eb4d0e7f58a557e86c8066ded069
child 567457 fb5a1a49ca4a4681b91a545ce49bbb7ca15bbe8c
push id38202
push userabutkovits@mozilla.com
push dateSun, 14 Feb 2021 09:42:09 +0000
treeherdermozilla-central@fb5a1a49ca4a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersntim, preferences-reviewers
bugs1691274
milestone87.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1691274 - Use DOM hidden property methods instead of attribute methods in browser/ directory. r=ntim,preferences-reviewers Differential Revision: https://phabricator.services.mozilla.com/D104552
accessible/tests/browser/mac/doc_aria_tabs.html
browser/actors/AboutReaderParent.jsm
browser/base/content/aboutNetError.js
browser/base/content/blockedSite.js
browser/base/content/browser-fullScreenAndPointerLock.js
browser/base/content/browser-places.js
browser/base/content/browser-sitePermissionPanel.js
browser/base/content/browser-sync.js
browser/base/content/browser.js
browser/base/content/nonbrowser-mac.js
browser/base/content/nsContextMenu.js
browser/base/content/tabbrowser.js
browser/components/customizableui/test/browser_886323_buildArea_removable_nodes.js
browser/components/downloads/DownloadsViewUI.jsm
browser/components/downloads/content/indicator.js
browser/components/fxmonitor/FirefoxMonitor.jsm
browser/components/newtab/lib/CFRPageActions.jsm
browser/components/newtab/lib/ToolbarBadgeHub.jsm
browser/components/newtab/lib/ToolbarPanelHub.jsm
browser/components/newtab/test/unit/lib/ToolbarPanelHub.test.js
browser/components/places/content/places.js
browser/components/pocket/content/SaveToPocket.jsm
browser/components/preferences/dialogs/sitePermissions.js
browser/components/preferences/privacy.js
browser/components/preferences/sync.js
browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
dom/tests/browser/browser_pointerlock_warning.js
--- a/accessible/tests/browser/mac/doc_aria_tabs.html
+++ b/accessible/tests/browser/mac/doc_aria_tabs.html
@@ -53,17 +53,17 @@
         .forEach(t => t.setAttribute("aria-selected", false));
 
       // Set this tab as selected
       target.setAttribute("aria-selected", true);
 
       // Hide all tab panels
       grandparent
         .querySelectorAll('[role="tabpanel"]')
-        .forEach(p => p.setAttribute("hidden", true));
+        .forEach(p => (p.hidden = true));
 
       // Show the selected panel
       grandparent.parentNode
         .querySelector(`#${target.getAttribute("aria-controls")}`)
         .removeAttribute("hidden");
     }
   </script>
   <title>ARIA: tab role - Example - code sample</title>
--- a/browser/actors/AboutReaderParent.jsm
+++ b/browser/actors/AboutReaderParent.jsm
@@ -187,34 +187,34 @@ class AboutReaderParent extends JSWindow
 
       let closeText = gStringBundle.GetStringFromName("readerView.close");
 
       button.setAttribute("readeractive", true);
       button.hidden = false;
       button.setAttribute("aria-label", closeText);
 
       menuitem.setAttribute("label", closeText);
-      menuitem.setAttribute("hidden", false);
+      menuitem.hidden = false;
       menuitem.setAttribute(
         "accesskey",
         gStringBundle.GetStringFromName("readerView.close.accesskey")
       );
 
       key.setAttribute("disabled", false);
 
       Services.obs.notifyObservers(null, "reader-mode-available");
     } else {
       let enterText = gStringBundle.GetStringFromName("readerView.enter");
 
       button.removeAttribute("readeractive");
       button.hidden = !browser.isArticle;
       button.setAttribute("aria-label", enterText);
 
       menuitem.setAttribute("label", enterText);
-      menuitem.setAttribute("hidden", !browser.isArticle);
+      menuitem.hidden = !browser.isArticle;
       menuitem.setAttribute(
         "accesskey",
         gStringBundle.GetStringFromName("readerView.enter.accesskey")
       );
 
       key.setAttribute("disabled", !browser.isArticle);
 
       if (browser.isArticle) {
--- a/browser/base/content/aboutNetError.js
+++ b/browser/base/content/aboutNetError.js
@@ -175,19 +175,17 @@ function setupAdvancedButton() {
 }
 
 function disallowCertOverridesIfNeeded() {
   var cssClass = getCSSClass();
   // Disallow overrides if this is a Strict-Transport-Security
   // host and the cert is bad (STS Spec section 7.3) or if the
   // certerror is in a frame (bug 633691).
   if (cssClass == "badStsCert" || window != top) {
-    document
-      .getElementById("exceptionDialogButton")
-      .setAttribute("hidden", "true");
+    document.getElementById("exceptionDialogButton").hidden = true;
   }
   if (cssClass == "badStsCert") {
     document.getElementById("badStsCertExplanation").removeAttribute("hidden");
 
     let stsReturnButtonText = document.getElementById("stsReturnButtonText")
       .textContent;
     document.getElementById("returnButton").textContent = stsReturnButtonText;
     document.getElementById(
--- a/browser/base/content/blockedSite.js
+++ b/browser/base/content/blockedSite.js
@@ -58,21 +58,17 @@ function getHostString() {
     return document.location.hostname;
   } catch (e) {
     return getURL();
   }
 }
 
 function onClickSeeDetails() {
   let details = document.getElementById("errorDescriptionContainer");
-  if (details.hidden) {
-    details.removeAttribute("hidden");
-  } else {
-    details.setAttribute("hidden", "true");
-  }
+  details.hidden = !details.hidden;
 }
 
 function initPage() {
   var error = "";
   switch (getErrorCode()) {
     case "malwareBlocked":
       error = "malware";
       break;
--- a/browser/base/content/browser-fullScreenAndPointerLock.js
+++ b/browser/base/content/browser-fullScreenAndPointerLock.js
@@ -85,17 +85,17 @@ var PointerlockFsWarning = {
       try {
         host = uri.host;
       } catch (e) {}
     }
     let textElem = this._element.querySelector(
       ".pointerlockfswarning-domain-text"
     );
     if (!host) {
-      textElem.setAttribute("hidden", true);
+      textElem.hidden = true;
     } else {
       textElem.removeAttribute("hidden");
       // Document's principal's URI has a host. Display a warning including it.
       let utils = {};
       ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm", utils);
       let displayHost = utils.DownloadUtils.getURIHost(uri.spec)[0];
       let l10nString = {
         "fullscreen-warning": "fullscreen-warning-domain",
@@ -130,17 +130,17 @@ var PointerlockFsWarning = {
     this._timeoutHide.cancel();
     this._timeoutShow.cancel();
     // Reset state of the warning box
     this._state = "hidden";
     // Reset state of the text so we don't persist or retranslate it.
     this._element
       .querySelector(".pointerlockfswarning-domain-text")
       .removeAttribute("data-l10n-id");
-    this._element.setAttribute("hidden", true);
+    this._element.hidden = true;
     // Remove all event listeners
     this._element.removeEventListener("transitionend", this);
     window.removeEventListener("mousemove", this, true);
     // Clear fields
     this._element = null;
     this._timeoutHide = null;
     this._timeoutShow = null;
 
@@ -226,17 +226,17 @@ var PointerlockFsWarning = {
               this._timeoutHide.cancel();
             }
           }
         }
         break;
       }
       case "transitionend": {
         if (this._state == "hiding") {
-          this._element.setAttribute("hidden", true);
+          this._element.hidden = true;
         }
         break;
       }
     }
   },
 };
 
 var PointerLock = {
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -686,21 +686,19 @@ HistoryMenu.prototype = {
       return SessionStore.getClosedTabCount(window);
     } catch (ex) {
       // SessionStore doesn't track the hidden window, so just return zero then.
       return 0;
     }
   },
 
   toggleHiddenTabs() {
-    if (window.gBrowser && gBrowser.visibleTabs.length < gBrowser.tabs.length) {
-      this.hiddenTabsMenu.removeAttribute("hidden");
-    } else {
-      this.hiddenTabsMenu.setAttribute("hidden", "true");
-    }
+    const isShown =
+      window.gBrowser && gBrowser.visibleTabs.length < gBrowser.tabs.length;
+    this.hiddenTabsMenu.hidden = !isShown;
   },
 
   toggleRecentlyClosedTabs: function HM_toggleRecentlyClosedTabs() {
     // enable/disable the Recently Closed Tabs sub menu
     // no restorable tabs, so disable menu
     if (this._getClosedTabCount() == 0) {
       this.undoTabMenu.setAttribute("disabled", true);
     } else {
@@ -781,21 +779,21 @@ HistoryMenu.prototype = {
   toggleTabsFromOtherComputers: function PHM_toggleTabsFromOtherComputers() {
     // Enable/disable the Tabs From Other Computers menu. Some of the menus handled
     // by HistoryMenu do not have this menuitem.
     if (!this.syncTabsMenuitem) {
       return;
     }
 
     if (!PlacesUIUtils.shouldShowTabsFromOtherComputersMenuitem()) {
-      this.syncTabsMenuitem.setAttribute("hidden", true);
+      this.syncTabsMenuitem.hidden = true;
       return;
     }
 
-    this.syncTabsMenuitem.setAttribute("hidden", false);
+    this.syncTabsMenuitem.hidden = false;
   },
 
   _onPopupShowing: function HM__onPopupShowing(aEvent) {
     PlacesMenu.prototype._onPopupShowing.apply(this, arguments);
 
     // Don't handle events for submenus.
     if (aEvent.target != aEvent.currentTarget) {
       return;
--- a/browser/base/content/browser-sitePermissionPanel.js
+++ b/browser/base/content/browser-sitePermissionPanel.js
@@ -186,17 +186,17 @@ var gPermissionPanel = {
    * Shows the permission popup.
    * @param {Event} event - Event which caused the popup to show.
    */
   _openPopup(event) {
     // Make the popup available.
     this._initializePopup();
 
     // Remove the reload hint that we show after a user has cleared a permission.
-    this._permissionReloadHint.setAttribute("hidden", "true");
+    this._permissionReloadHint.hidden = true;
 
     // Update the popup strings
     this._refreshPermissionPopup();
 
     // Add the "open" attribute to the button in the identity box for styling
     this._identityPermissionBox.setAttribute("open", "true");
 
     // Check the panel state of other panels. Hide them if needed.
@@ -358,17 +358,17 @@ var gPermissionPanel = {
         delete this._event;
         break;
       }
     }
   },
 
   onLocationChange() {
     if (this._popupInitialized && this._permissionPopup.state != "closed") {
-      this._permissionReloadHint.setAttribute("hidden", "true");
+      this._permissionReloadHint.hidden = true;
     }
   },
 
   /**
    * Updates the permission list in the permissions popup.
    */
   updateSitePermissions() {
     let permissionItemSelector = [
@@ -774,17 +774,17 @@ var gPermissionPanel = {
         }
       }
       SitePermissions.removeFromPrincipal(
         gBrowser.contentPrincipal,
         aPermission.id,
         browser
       );
 
-      this._permissionReloadHint.removeAttribute("hidden");
+      this._permissionReloadHint.hidden = false;
       PanelView.forNode(
         this._permissionPopupMainView
       ).descriptionHeightWorkaround();
 
       if (aPermission.id === "geo") {
         gBrowser.updateBrowserSharing(browser, { geo: false });
       } else if (aPermission.id === "xr") {
         gBrowser.updateBrowserSharing(browser, { xr: false });
--- a/browser/base/content/browser-sync.js
+++ b/browser/base/content/browser-sync.js
@@ -497,20 +497,20 @@ var gSync = {
       document,
       "appMenu-fxa-label"
     );
 
     let panelTitle = this.fxaStrings.GetStringFromName("account.title");
 
     fxaMenuPanel.removeAttribute("title");
     cadButtonEl.setAttribute("disabled", true);
-    syncNowButtonEl.setAttribute("hidden", true);
+    syncNowButtonEl.hidden = true;
     fxaMenuAccountButtonEl.classList.remove("subviewbutton-nav");
     fxaMenuAccountButtonEl.removeAttribute("closemenu");
-    syncPrefsButtonEl.setAttribute("hidden", true);
+    syncPrefsButtonEl.hidden = true;
     syncSetupButtonEl.removeAttribute("hidden");
 
     if (state.status === UIState.STATUS_NOT_CONFIGURED) {
       mainWindowEl.style.removeProperty("--avatar-image-url");
     } else if (state.status === UIState.STATUS_LOGIN_FAILED) {
       stateValue = "login-failed";
       headerTitle = this.fxaStrings.GetStringFromName("account.reconnectToFxA");
       headerDescription = state.email;
@@ -542,17 +542,17 @@ var gSync = {
         mainWindowEl.style.removeProperty("--avatar-image-url");
       }
 
       cadButtonEl.removeAttribute("disabled");
 
       if (state.syncEnabled) {
         syncNowButtonEl.removeAttribute("hidden");
         syncPrefsButtonEl.removeAttribute("hidden");
-        syncSetupButtonEl.setAttribute("hidden", true);
+        syncSetupButtonEl.hidden = true;
       }
 
       fxaMenuAccountButtonEl.classList.add("subviewbutton-nav");
       fxaMenuAccountButtonEl.setAttribute("closemenu", "none");
 
       headerTitle = state.email;
       headerDescription = this.fxaStrings.GetStringFromName(
         "account.accountSettings"
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1176,17 +1176,17 @@ var gPopupBlockerObserver = {
         // Offer an item to allow popups for this site
         let allowString = gNavigatorBundle.getFormattedString("popupAllow", [
           uriHost,
         ]);
         blockedPopupAllowSite.setAttribute("label", allowString);
         blockedPopupAllowSite.removeAttribute("block");
       }
     } catch (e) {
-      blockedPopupAllowSite.setAttribute("hidden", "true");
+      blockedPopupAllowSite.hidden = true;
     }
 
     if (PrivateBrowsingUtils.isWindowPrivate(window)) {
       blockedPopupAllowSite.setAttribute("disabled", "true");
     } else {
       blockedPopupAllowSite.removeAttribute("disabled");
     }
 
@@ -1200,17 +1200,17 @@ var gPopupBlockerObserver = {
     blockedPopupDontShowMessage.setAttribute(
       "label",
       gNavigatorBundle.getString("popupWarningDontShowFromMessage")
     );
 
     let blockedPopupsSeparator = document.getElementById(
       "blockedPopupsSeparator"
     );
-    blockedPopupsSeparator.setAttribute("hidden", true);
+    blockedPopupsSeparator.hidden = true;
 
     browser.popupBlocker.getBlockedPopups().then(blockedPopups => {
       let foundUsablePopupURI = false;
       if (blockedPopups) {
         for (let i = 0; i < blockedPopups.length; i++) {
           let blockedPopup = blockedPopups[i];
 
           // popupWindowURI will be null if the file picker popup is blocked.
@@ -8399,19 +8399,17 @@ var RestoreLastSessionObserver = {
   init() {
     if (
       SessionStore.canRestoreLastSession &&
       !PrivateBrowsingUtils.isWindowPrivate(window)
     ) {
       Services.obs.addObserver(this, "sessionstore-last-session-cleared", true);
       goSetCommandEnabled("Browser:RestoreLastSession", true);
     } else if (SessionStore.willAutoRestore) {
-      document
-        .getElementById("Browser:RestoreLastSession")
-        .setAttribute("hidden", true);
+      document.getElementById("Browser:RestoreLastSession").hidden = true;
     }
   },
 
   observe() {
     // The last session can only be restored once so there's
     // no way we need to re-enable our menu item.
     Services.obs.removeObserver(this, "sessionstore-last-session-cleared");
     goSetCommandEnabled("Browser:RestoreLastSession", false);
--- a/browser/base/content/nonbrowser-mac.js
+++ b/browser/base/content/nonbrowser-mac.js
@@ -80,17 +80,17 @@ function nonBrowserWindowStartup() {
       element = document.getElementById(hiddenWindowDisabledItem);
       if (element) {
         element.setAttribute("disabled", "true");
       }
     }
 
     // Also hide the window-list separator.
     element = document.getElementById("sep-window-list");
-    element.setAttribute("hidden", "true");
+    element.hidden = true;
 
     // Setup the dock menu.
     let dockMenuElement = document.getElementById("menu_mac_dockmenu");
     if (dockMenuElement != null) {
       let nativeMenu = Cc[
         "@mozilla.org/widget/standalonenativemenu;1"
       ].createInstance(Ci.nsIStandaloneNativeMenu);
 
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -714,23 +714,19 @@ class nsContextMenu {
     this.showItem("context-openframe", !this.inSrcdocFrame);
     this.showItem("context-bookmarkframe", !this.inSrcdocFrame);
     this.showItem("open-frame-sep", !this.inSrcdocFrame);
 
     this.showItem("frame-sep", this.inFrame && this.isTextSelected);
 
     // Hide menu entries for images, show otherwise
     if (this.inFrame) {
-      if (
-        BrowserUtils.mimeTypeIsTextBased(this.target.ownerDocument.contentType)
-      ) {
-        this.viewFrameSourceElement.removeAttribute("hidden");
-      } else {
-        this.viewFrameSourceElement.setAttribute("hidden", "true");
-      }
+      this.viewFrameSourceElement.hidden = !BrowserUtils.mimeTypeIsTextBased(
+        this.target.ownerDocument.contentType
+      );
     }
 
     // BiDi UI
     this.showItem("context-sep-bidi", !this.onNumeric && top.gBidiUI);
     this.showItem(
       "context-bidi-text-direction-toggle",
       this.onTextInput && !this.onNumeric && top.gBidiUI
     );
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -2943,17 +2943,17 @@
             this._fireTabOpen(tab, {});
             this._notifyPinnedStatus(tab);
             // Once we're done adding all tabs, _updateTabBarForPinnedTabs
             // needs calling:
             shouldUpdateForPinnedTabs = true;
           }
         } else {
           if (tab.hidden) {
-            tab.setAttribute("hidden", "true");
+            tab.hidden = true;
             hiddenTabs.set(tab, tabData.extData && tabData.extData.hiddenBy);
           }
 
           tabsFragment.appendChild(tab);
           if (tabWasReused) {
             this._invalidateCachedTabs();
           }
         }
--- a/browser/components/customizableui/test/browser_886323_buildArea_removable_nodes.js
+++ b/browser/components/customizableui/test/browser_886323_buildArea_removable_nodes.js
@@ -13,17 +13,17 @@ var gLazyArea;
 // Removable nodes shouldn't be moved by buildArea
 add_task(async function() {
   let dummyBtn = createDummyXULButton(kButtonId, "Dummy");
   dummyBtn.setAttribute("removable", "true");
   CustomizableUI.getCustomizationTarget(gNavBar).appendChild(dummyBtn);
   let popupSet = document.getElementById("mainPopupSet");
   gLazyArea = document.createXULElement("panel");
   gLazyArea.id = kLazyAreaId;
-  gLazyArea.setAttribute("hidden", "true");
+  gLazyArea.hidden = true;
   popupSet.appendChild(gLazyArea);
   CustomizableUI.registerArea(kLazyAreaId, {
     type: CustomizableUI.TYPE_MENU_PANEL,
     defaultPlacements: [],
   });
   CustomizableUI.addWidgetToArea(kButtonId, kLazyAreaId);
   assertAreaPlacements(
     kLazyAreaId,
--- a/browser/components/downloads/DownloadsViewUI.jsm
+++ b/browser/components/downloads/DownloadsViewUI.jsm
@@ -399,17 +399,17 @@ DownloadsViewUI.DownloadElementShell.pro
         descriptionL10nId
       );
     }
     this._downloadButton.setAttribute("class", "downloadButton " + iconClass);
     this._downloadButton.removeAttribute("hidden");
   },
 
   hideButton() {
-    this._downloadButton.setAttribute("hidden", "true");
+    this._downloadButton.hidden = true;
   },
 
   lastEstimatedSecondsLeft: Infinity,
 
   /**
    * This is called when a major state change occurs in the download, but is not
    * called for every progress update in order to improve performance.
    */
--- a/browser/components/downloads/content/indicator.js
+++ b/browser/components/downloads/content/indicator.js
@@ -149,17 +149,17 @@ const DownloadsButton = {
       }
     }
   },
 
   hide() {
     let button = this._placeholder;
     if (this.autoHideDownloadsButton && button && button.closest("toolbar")) {
       DownloadsPanel.hidePanel();
-      button.setAttribute("hidden", "true");
+      button.hidden = true;
       this._navBar.removeAttribute("downloadsbuttonshown");
     }
   },
 
   startAutoHide() {
     if (DownloadsIndicatorView.hasDownloads) {
       this.unhide();
     } else {
@@ -445,17 +445,17 @@ const DownloadsIndicatorView = {
     let animationDuration;
     // This value is determined by the overall duration of animation in CSS.
     animationDuration = aType == "start" ? 760 : 850;
 
     this._currentNotificationType = aType;
 
     setTimeout(() => {
       requestAnimationFrame(() => {
-        notifier.setAttribute("hidden", "true");
+        notifier.hidden = true;
         notifier.removeAttribute("notification");
         notifier.style.transform = "";
         anchor.removeAttribute("notification");
 
         requestAnimationFrame(() => {
           let nextType = this._nextNotificationType;
           this._currentNotificationType = null;
           this._nextNotificationType = null;
--- a/browser/components/fxmonitor/FirefoxMonitor.jsm
+++ b/browser/components/fxmonitor/FirefoxMonitor.jsm
@@ -363,17 +363,17 @@ this.FirefoxMonitor = {
     // Now, the popupnotificationcontent:
     let parentElt = doc.defaultView.PopupNotifications.panel.parentNode;
     let pn = doc.createXULElement("popupnotification");
     let pnContent = doc.createXULElement("popupnotificationcontent");
     let panelUI = new PanelUI(doc);
     pnContent.appendChild(panelUI.box);
     pn.appendChild(pnContent);
     pn.setAttribute("id", `${this.kNotificationID}-notification`);
-    pn.setAttribute("hidden", "true");
+    pn.hidden = true;
     parentElt.appendChild(pn);
     this.panelUIsByWindow.set(win, panelUI);
     return panelUI;
   },
 
   stopObserving() {
     if (!this.observerAdded) {
       return;
--- a/browser/components/newtab/lib/CFRPageActions.jsm
+++ b/browser/components/newtab/lib/CFRPageActions.jsm
@@ -415,29 +415,26 @@ class PageAction {
     if (users) {
       footerUsers.setAttribute(
         "value",
         await this.getStrings({
           string_id: "cfr-doorhanger-extension-total-users",
           args: { total: users },
         })
       );
-      footerUsers.removeAttribute("hidden");
+      footerUsers.hidden = false;
     } else {
       // Prevent whitespace around empty label from affecting other spacing
-      footerUsers.setAttribute("hidden", true);
+      footerUsers.hidden = true;
       footerUsers.removeAttribute("value");
     }
 
     // Spacer pushes the link to the opposite end when there's other content
-    if (rating || users) {
-      footerSpacer.removeAttribute("hidden");
-    } else {
-      footerSpacer.setAttribute("hidden", true);
-    }
+
+    footerSpacer.hidden = !rating && !users;
   }
 
   _createElementAndAppend({ type, id }, parent) {
     let element = this.window.document.createXULElement(type);
     if (id) {
       element.setAttribute("id", id);
     }
     parent.appendChild(element);
--- a/browser/components/newtab/lib/ToolbarBadgeHub.jsm
+++ b/browser/components/newtab/lib/ToolbarBadgeHub.jsm
@@ -184,17 +184,17 @@ class _ToolbarBadgeHub {
           "aria-describedby",
           `toolbarbutton-notification-description ${message.content.target}`
         );
         const descriptionEl = document.createElement("span");
         descriptionEl.setAttribute(
           "id",
           "toolbarbutton-notification-description"
         );
-        descriptionEl.setAttribute("hidden", true);
+        descriptionEl.hidden = true;
         document.l10n.setAttributes(
           descriptionEl,
           message.content.badgeDescription.string_id
         );
         toolbarbutton.appendChild(descriptionEl);
       }
       // `mousedown` event required because of the `onmousedown` defined on
       // the button that prevents `click` events from firing
--- a/browser/components/newtab/lib/ToolbarPanelHub.jsm
+++ b/browser/components/newtab/lib/ToolbarPanelHub.jsm
@@ -497,23 +497,23 @@ class _ToolbarPanelHub {
 
   _hideToolbarButton(win) {
     this._hideElement(win.browser.ownerDocument, TOOLBAR_BUTTON_ID);
   }
 
   _showElement(document, id, string_id) {
     const el = PanelMultiView.getViewNode(document, id);
     document.l10n.setAttributes(el, string_id);
-    el.removeAttribute("hidden");
+    el.hidden = false;
   }
 
   _hideElement(document, id) {
     const el = PanelMultiView.getViewNode(document, id);
     if (el) {
-      el.setAttribute("hidden", true);
+      el.hidden = true;
     }
   }
 
   _sendPing(ping) {
     this._sendTelemetry({
       type: "TOOLBAR_PANEL_TELEMETRY",
       data: { action: "whats-new-panel_user_event", ...ping },
     });
--- a/browser/components/newtab/test/unit/lib/ToolbarPanelHub.test.js
+++ b/browser/components/newtab/test/unit/lib/ToolbarPanelHub.test.js
@@ -309,41 +309,41 @@ describe("ToolbarPanelHub", () => {
 
       assert.notCalled(everyWindowStub.registerCallback);
     });
   });
   describe("Show/Hide functions", () => {
     it("should unhide appmenu button on _showAppmenuButton()", async () => {
       await instance._showAppmenuButton(fakeWindow);
 
-      assert.calledWith(fakeElementById.removeAttribute, "hidden");
+      assert.equal(fakeElementById.hidden, false);
     });
     it("should hide appmenu button on _hideAppmenuButton()", () => {
       instance._hideAppmenuButton(fakeWindow);
-      assert.calledWith(fakeElementById.setAttribute, "hidden", true);
+      assert.equal(fakeElementById.hidden, true);
     });
     it("should not do anything if the window is closed", () => {
       instance._hideAppmenuButton(fakeWindow, true);
       assert.notCalled(PanelMultiView.getViewNode);
     });
     it("should not throw if the element does not exist", () => {
       let fn = instance._hideAppmenuButton.bind(null, {
         browser: { ownerDocument: {} },
       });
       getViewNodeStub.returns(undefined);
       assert.doesNotThrow(fn);
     });
     it("should unhide toolbar button on _showToolbarButton()", async () => {
       await instance._showToolbarButton(fakeWindow);
 
-      assert.calledWith(fakeElementById.removeAttribute, "hidden");
+      assert.equal(fakeElementById.hidden, false);
     });
     it("should hide toolbar button on _hideToolbarButton()", () => {
       instance._hideToolbarButton(fakeWindow);
-      assert.calledWith(fakeElementById.setAttribute, "hidden", true);
+      assert.equal(fakeElementById.hidden, true);
     });
   });
   describe("#renderMessages", () => {
     let getMessagesStub;
     beforeEach(() => {
       getMessagesStub = sandbox.stub();
       instance.init(waitForInitializedStub, {
         getMessages: getMessagesStub,
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -1190,26 +1190,20 @@ var ViewMenu = {
   showHideColumn: function VM_showHideColumn(element) {
     var column = element.column;
 
     var splitter = column.nextSibling;
     if (splitter && splitter.localName != "splitter") {
       splitter = null;
     }
 
-    if (element.getAttribute("checked") == "true") {
-      column.setAttribute("hidden", "false");
-      if (splitter) {
-        splitter.removeAttribute("hidden");
-      }
-    } else {
-      column.setAttribute("hidden", "true");
-      if (splitter) {
-        splitter.setAttribute("hidden", "true");
-      }
+    const isChecked = element.getAttribute("checked") == "true";
+    column.hidden = !isChecked;
+    if (splitter) {
+      splitter.hidden = !isChecked;
     }
   },
 
   /**
    * Gets the last column that was sorted.
    * @returns  the currently sorted column, null if there is no sorted column.
    */
   _getSortColumn: function VM__getSortColumn() {
--- a/browser/components/pocket/content/SaveToPocket.jsm
+++ b/browser/components/pocket/content/SaveToPocket.jsm
@@ -174,17 +174,17 @@ var PocketPageAction = {
   shutdown() {
     if (!this.pageAction) {
       return;
     }
 
     for (let win of browserWindows()) {
       let doc = win.document;
       let pocketButton = doc.getElementById("pocket-button");
-      pocketButton.setAttribute("hidden", "true");
+      pocketButton.hidden = true;
     }
 
     this.pageAction.remove();
     this.pageAction = null;
   },
 };
 
 // PocketContextMenu
--- a/browser/components/preferences/dialogs/sitePermissions.js
+++ b/browser/components/preferences/dialogs/sitePermissions.js
@@ -223,18 +223,18 @@ var gSitePermissionsManager = {
     let pref = Services.prefs.getPrefType(this._defaultPermissionStatePrefName);
     if (pref != Services.prefs.PREF_INVALID) {
       this._currentDefaultPermissionsState = Services.prefs.getIntPref(
         this._defaultPermissionStatePrefName
       );
     }
 
     if (this._currentDefaultPermissionsState === null) {
-      this._checkbox.setAttribute("hidden", true);
-      this._permissionsDisableDescription.setAttribute("hidden", true);
+      this._checkbox.hidden = true;
+      this._permissionsDisableDescription.hidden = true;
     } else if (this._currentDefaultPermissionsState == SitePermissions.BLOCK) {
       this._checkbox.checked = true;
     } else {
       this._checkbox.checked = false;
     }
 
     if (Services.prefs.prefIsLocked(this._defaultPermissionStatePrefName)) {
       this._checkbox.disabled = true;
--- a/browser/components/preferences/privacy.js
+++ b/browser/components/preferences/privacy.js
@@ -1473,17 +1473,17 @@ var gPrivacyPane = {
 
       clearDataSettings.removeAttribute("hidden");
 
       if (!disabled) {
         // adjust the Settings button for sanitizeOnShutdown
         this._updateSanitizeSettingsButton();
       }
     } else {
-      clearDataSettings.setAttribute("hidden", "true");
+      clearDataSettings.hidden = true;
     }
   },
 
   ensurePrivacyMicroControlUncheckedWhenDisabled(el) {
     if (Preferences.get("browser.privatebrowsing.autostart").value) {
       // Set checked to false when called from updatePrivacyMicroControls
       el.checked = false;
       // return false for the onsyncfrompreference case:
@@ -2418,17 +2418,17 @@ var gPrivacyPane = {
   _setupLearnMoreLink(pref, element) {
     // set up the Learn More link with the correct URL
     let url = Services.urlFormatter.formatURLPref(pref);
     let el = document.getElementById(element);
 
     if (url) {
       el.setAttribute("href", url);
     } else {
-      el.setAttribute("hidden", "true");
+      el.hidden = true;
     }
   },
 
   /**
    * Initialize the health report service reference and checkbox.
    */
   initSubmitHealthReport() {
     this._setupLearnMoreLink(
--- a/browser/components/preferences/sync.js
+++ b/browser/components/preferences/sync.js
@@ -582,22 +582,17 @@ var gSyncPane = {
     }
     textbox.value = value;
   },
 
   // arranges to dynamically show or hide sync engine name elements based on the
   // preferences used for this engines.
   setupEnginesUI() {
     let observe = (elt, prefName) => {
-      let enabled = Services.prefs.getBoolPref(prefName, false);
-      if (enabled) {
-        elt.removeAttribute("hidden");
-      } else {
-        elt.setAttribute("hidden", "true");
-      }
+      elt.hidden = !Services.prefs.getBoolPref(prefName, false);
     };
 
     for (let elt of document.querySelectorAll("[engine_preference]")) {
       let prefName = elt.getAttribute("engine_preference");
       let obs = observe.bind(null, elt, prefName);
       obs();
       Services.prefs.addObserver(prefName, obs);
       window.addEventListener("unload", () => {
--- a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
+++ b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
@@ -58,17 +58,17 @@ document.addEventListener("DOMContentLoa
       document.body.classList.add("showBanner");
     }
 
     // We set this attribute so that tests know when we are done.
     document.documentElement.setAttribute("SearchBannerInitialized", true);
   });
 
   function hideSearchBanner() {
-    privateSearchBanner.setAttribute("hidden", "true");
+    privateSearchBanner.hidden = true;
     document.body.classList.remove("showBanner");
     RPMSendAsyncMessage("SearchBannerDismissed");
   }
 
   document
     .getElementById("search-banner-close-button")
     .addEventListener("click", () => {
       hideSearchBanner();
--- a/dom/tests/browser/browser_pointerlock_warning.js
+++ b/dom/tests/browser/browser_pointerlock_warning.js
@@ -47,17 +47,17 @@ add_task(async function show_pointerlock
 
     await warningShownPromise;
 
     ok(true, "Pointerlock warning shown");
 
     let warningHiddenPromise = BrowserTestUtils.waitForAttribute(
       "hidden",
       warning,
-      "true"
+      ""
     );
 
     is(warning.innerText, expectedWarningText, "Warning text");
 
     EventUtils.synthesizeKey("KEY_Escape");
     await warningHiddenPromise;
 
     ok(true, "Pointerlock warning hidden");