Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6928)

Unified Diff: chrome/browser/resources/options/options_page.js

Issue 5024004: dom-ui settings: prefer to add/remove class 'hidden' rather than manipulate t... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/options_page.js
===================================================================
--- chrome/browser/resources/options/options_page.js (revision 66306)
+++ chrome/browser/resources/options/options_page.js (working copy)
@@ -109,8 +109,7 @@
pageInfo.page.visible = false;
// Since the managed pref banner lives outside the overlay, and the
// parent is not changing visibility, update the banner explicitly.
- var banner = $('managed-prefs-banner');
- banner.style.display = pageInfo.parentPage.managed ? 'block' : 'none';
+ pageInfo.parentPage.updateManagedBannerVisibility();
}
}
};
@@ -138,7 +137,7 @@
tab.classList.add('active-tab');
$(tab.getAttribute('tab-contents')).classList.add('active-tab-contents');
this.activeNavTab = tab;
- }
+ };
/**
* Registers new options page.
@@ -232,11 +231,22 @@
setManagedBannerVisibility: function(visible) {
this.managed = visible;
if (this.visible) {
- $('managed-prefs-banner').style.display = visible ? 'block' : 'none';
+ this.updateManagedBannerVisibility();
}
},
/**
+ * Updates managed banner visibility state.
+ */
+ updateManagedBannerVisibility: function() {
+ if (this.managed) {
+ $('managed-prefs-banner').classList.remove('hidden');
+ } else {
+ $('managed-prefs-banner').classList.add('hidden');
+ }
+ },
+
+ /**
* Gets page visibility state.
*/
get visible() {
@@ -253,36 +263,32 @@
return;
if (visible) {
- this.pageDiv.style.display = 'block';
+ this.pageDiv.classList.remove('hidden');
if (this.isOverlay) {
- var overlay = $('overlay');
- overlay.classList.remove('hidden');
+ $('overlay').classList.remove('hidden');
document.addEventListener('keydown',
OptionsPage.clearOverlaysOnEsc_);
} else {
if (this.isSubPageSheet)
$('subpage-sheet-container').classList.remove('hidden');
- var banner = $('managed-prefs-banner');
- banner.style.display = this.managed ? 'block' : 'none';
+ this.updateManagedBannerVisibility();
// Recent webkit change no longer allows url change from "chrome://".
- window.history.pushState({pageName: this.name},
- this.title);
+ window.history.pushState({pageName: this.name}, this.title);
}
if (this.tab) {
this.tab.classList.add('navbar-item-selected');
}
} else {
+ this.pageDiv.classList.add('hidden');
if (this.isOverlay) {
- var overlay = $('overlay');
- overlay.classList.add('hidden');
+ $('overlay').classList.add('hidden');
document.removeEventListener('keydown',
OptionsPage.clearOverlaysOnEsc_);
} else if (this.isSubPageSheet) {
$('subpage-sheet-container').classList.add('hidden');
}
- this.pageDiv.style.display = 'none';
if (this.tab) {
this.tab.classList.remove('navbar-item-selected');
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698