зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
891e453d2f
Коммит
16060f0cc4
|
@ -58,7 +58,7 @@
|
|||
// 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
|
||||
|
|
|
@ -192,7 +192,7 @@ class AboutReaderParent extends JSWindowActorParent {
|
|||
button.setAttribute("aria-label", closeText);
|
||||
|
||||
menuitem.setAttribute("label", closeText);
|
||||
menuitem.setAttribute("hidden", false);
|
||||
menuitem.hidden = false;
|
||||
menuitem.setAttribute(
|
||||
"accesskey",
|
||||
gStringBundle.GetStringFromName("readerView.close.accesskey")
|
||||
|
@ -209,7 +209,7 @@ class AboutReaderParent extends JSWindowActorParent {
|
|||
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")
|
||||
|
|
|
@ -180,9 +180,7 @@ function disallowCertOverridesIfNeeded() {
|
|||
// 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");
|
||||
|
|
|
@ -63,11 +63,7 @@ function getHostString() {
|
|||
|
||||
function onClickSeeDetails() {
|
||||
let details = document.getElementById("errorDescriptionContainer");
|
||||
if (details.hidden) {
|
||||
details.removeAttribute("hidden");
|
||||
} else {
|
||||
details.setAttribute("hidden", "true");
|
||||
}
|
||||
details.hidden = !details.hidden;
|
||||
}
|
||||
|
||||
function initPage() {
|
||||
|
|
|
@ -90,7 +90,7 @@ var PointerlockFsWarning = {
|
|||
".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.
|
||||
|
@ -135,7 +135,7 @@ var PointerlockFsWarning = {
|
|||
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);
|
||||
|
@ -231,7 +231,7 @@ var PointerlockFsWarning = {
|
|||
}
|
||||
case "transitionend": {
|
||||
if (this._state == "hiding") {
|
||||
this._element.setAttribute("hidden", true);
|
||||
this._element.hidden = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -691,11 +691,9 @@ HistoryMenu.prototype = {
|
|||
},
|
||||
|
||||
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() {
|
||||
|
@ -786,11 +784,11 @@ HistoryMenu.prototype = {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -191,7 +191,7 @@ var gPermissionPanel = {
|
|||
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();
|
||||
|
@ -363,7 +363,7 @@ var gPermissionPanel = {
|
|||
|
||||
onLocationChange() {
|
||||
if (this._popupInitialized && this._permissionPopup.state != "closed") {
|
||||
this._permissionReloadHint.setAttribute("hidden", "true");
|
||||
this._permissionReloadHint.hidden = true;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -779,7 +779,7 @@ var gPermissionPanel = {
|
|||
browser
|
||||
);
|
||||
|
||||
this._permissionReloadHint.removeAttribute("hidden");
|
||||
this._permissionReloadHint.hidden = false;
|
||||
PanelView.forNode(
|
||||
this._permissionPopupMainView
|
||||
).descriptionHeightWorkaround();
|
||||
|
|
|
@ -502,10 +502,10 @@ var gSync = {
|
|||
|
||||
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) {
|
||||
|
@ -547,7 +547,7 @@ var gSync = {
|
|||
if (state.syncEnabled) {
|
||||
syncNowButtonEl.removeAttribute("hidden");
|
||||
syncPrefsButtonEl.removeAttribute("hidden");
|
||||
syncSetupButtonEl.setAttribute("hidden", true);
|
||||
syncSetupButtonEl.hidden = true;
|
||||
}
|
||||
|
||||
fxaMenuAccountButtonEl.classList.add("subviewbutton-nav");
|
||||
|
|
|
@ -1181,7 +1181,7 @@ var gPopupBlockerObserver = {
|
|||
blockedPopupAllowSite.removeAttribute("block");
|
||||
}
|
||||
} catch (e) {
|
||||
blockedPopupAllowSite.setAttribute("hidden", "true");
|
||||
blockedPopupAllowSite.hidden = true;
|
||||
}
|
||||
|
||||
if (PrivateBrowsingUtils.isWindowPrivate(window)) {
|
||||
|
@ -1205,7 +1205,7 @@ var gPopupBlockerObserver = {
|
|||
let blockedPopupsSeparator = document.getElementById(
|
||||
"blockedPopupsSeparator"
|
||||
);
|
||||
blockedPopupsSeparator.setAttribute("hidden", true);
|
||||
blockedPopupsSeparator.hidden = true;
|
||||
|
||||
browser.popupBlocker.getBlockedPopups().then(blockedPopups => {
|
||||
let foundUsablePopupURI = false;
|
||||
|
@ -8404,9 +8404,7 @@ var RestoreLastSessionObserver = {
|
|||
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;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ function nonBrowserWindowStartup() {
|
|||
|
||||
// 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");
|
||||
|
|
|
@ -719,13 +719,9 @@ class nsContextMenu {
|
|||
|
||||
// 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
|
||||
|
|
|
@ -2948,7 +2948,7 @@
|
|||
}
|
||||
} else {
|
||||
if (tab.hidden) {
|
||||
tab.setAttribute("hidden", "true");
|
||||
tab.hidden = true;
|
||||
hiddenTabs.set(tab, tabData.extData && tabData.extData.hiddenBy);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ add_task(async function() {
|
|||
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,
|
||||
|
|
|
@ -404,7 +404,7 @@ DownloadsViewUI.DownloadElementShell.prototype = {
|
|||
},
|
||||
|
||||
hideButton() {
|
||||
this._downloadButton.setAttribute("hidden", "true");
|
||||
this._downloadButton.hidden = true;
|
||||
},
|
||||
|
||||
lastEstimatedSecondsLeft: Infinity,
|
||||
|
|
|
@ -154,7 +154,7 @@ const DownloadsButton = {
|
|||
let button = this._placeholder;
|
||||
if (this.autoHideDownloadsButton && button && button.closest("toolbar")) {
|
||||
DownloadsPanel.hidePanel();
|
||||
button.setAttribute("hidden", "true");
|
||||
button.hidden = true;
|
||||
this._navBar.removeAttribute("downloadsbuttonshown");
|
||||
}
|
||||
},
|
||||
|
@ -450,7 +450,7 @@ const DownloadsIndicatorView = {
|
|||
|
||||
setTimeout(() => {
|
||||
requestAnimationFrame(() => {
|
||||
notifier.setAttribute("hidden", "true");
|
||||
notifier.hidden = true;
|
||||
notifier.removeAttribute("notification");
|
||||
notifier.style.transform = "";
|
||||
anchor.removeAttribute("notification");
|
||||
|
|
|
@ -368,7 +368,7 @@ this.FirefoxMonitor = {
|
|||
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;
|
||||
|
|
|
@ -420,19 +420,16 @@ class PageAction {
|
|||
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) {
|
||||
|
|
|
@ -189,7 +189,7 @@ class _ToolbarBadgeHub {
|
|||
"id",
|
||||
"toolbarbutton-notification-description"
|
||||
);
|
||||
descriptionEl.setAttribute("hidden", true);
|
||||
descriptionEl.hidden = true;
|
||||
document.l10n.setAttributes(
|
||||
descriptionEl,
|
||||
message.content.badgeDescription.string_id
|
||||
|
|
|
@ -502,13 +502,13 @@ class _ToolbarPanelHub {
|
|||
_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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -314,11 +314,11 @@ describe("ToolbarPanelHub", () => {
|
|||
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);
|
||||
|
@ -334,11 +334,11 @@ describe("ToolbarPanelHub", () => {
|
|||
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", () => {
|
||||
|
|
|
@ -1195,16 +1195,10 @@ var ViewMenu = {
|
|||
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;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ var PocketPageAction = {
|
|||
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();
|
||||
|
|
|
@ -228,8 +228,8 @@ var gSitePermissionsManager = {
|
|||
}
|
||||
|
||||
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 {
|
||||
|
|
|
@ -1478,7 +1478,7 @@ var gPrivacyPane = {
|
|||
this._updateSanitizeSettingsButton();
|
||||
}
|
||||
} else {
|
||||
clearDataSettings.setAttribute("hidden", "true");
|
||||
clearDataSettings.hidden = true;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -2423,7 +2423,7 @@ var gPrivacyPane = {
|
|||
if (url) {
|
||||
el.setAttribute("href", url);
|
||||
} else {
|
||||
el.setAttribute("hidden", "true");
|
||||
el.hidden = true;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -587,12 +587,7 @@ var gSyncPane = {
|
|||
// 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]")) {
|
||||
|
|
|
@ -63,7 +63,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
});
|
||||
|
||||
function hideSearchBanner() {
|
||||
privateSearchBanner.setAttribute("hidden", "true");
|
||||
privateSearchBanner.hidden = true;
|
||||
document.body.classList.remove("showBanner");
|
||||
RPMSendAsyncMessage("SearchBannerDismissed");
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ add_task(async function show_pointerlock_warning_escape() {
|
|||
let warningHiddenPromise = BrowserTestUtils.waitForAttribute(
|
||||
"hidden",
|
||||
warning,
|
||||
"true"
|
||||
""
|
||||
);
|
||||
|
||||
is(warning.innerText, expectedWarningText, "Warning text");
|
||||
|
|
Загрузка…
Ссылка в новой задаче