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

Unified Diff: chrome/browser/resources/settings/search_settings.js

Issue 2223083003: MD Settings: Skip hidden nodes when searching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_subpage_assertion
Patch Set: Change class to attribute. Created 4 years, 4 months 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 | chrome/browser/resources/settings/settings_page/settings_section.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/search_settings.js
diff --git a/chrome/browser/resources/settings/search_settings.js b/chrome/browser/resources/settings/search_settings.js
index 8d657744d5d7711dcffc09b4c71950dab5eb0689..4909b9f50d99c891fe475e90e4f90eb7d45d2a25 100644
--- a/chrome/browser/resources/settings/search_settings.js
+++ b/chrome/browser/resources/settings/search_settings.js
@@ -13,7 +13,7 @@ cr.define('settings', function() {
var SEARCH_BUBBLE_CSS_CLASS = 'search-bubble';
/**
- * A CSS attribute indicating that a node shoud be ignored during searching.
+ * A CSS attribute indicating that a node should be ignored during searching.
* @const {string}
*/
var SKIP_SEARCH_CSS_ATTRIBUTE = 'no-search';
@@ -128,9 +128,16 @@ cr.define('settings', function() {
return;
}
- if (IGNORED_ELEMENTS.has(node.nodeName) ||
- (node.hasAttribute && node.hasAttribute(SKIP_SEARCH_CSS_ATTRIBUTE))) {
+ if (IGNORED_ELEMENTS.has(node.nodeName))
return;
+
+ if (node instanceof HTMLElement) {
+ var element = /** @type {HTMLElement} */(node);
+ if (element.hasAttribute(SKIP_SEARCH_CSS_ATTRIBUTE) ||
+ element.hasAttribute('hidden') ||
+ element.style.display == 'none') {
+ return;
+ }
}
if (node.nodeType == Node.TEXT_NODE) {
@@ -214,7 +221,7 @@ cr.define('settings', function() {
}
}
if (parent)
- parent.hidden = false;
+ parent.hiddenBySearch = false;
// Need to add the search bubble after the parent SETTINGS-SECTION has
// become visible, otherwise |offsetWidth| returns zero.
@@ -335,7 +342,7 @@ cr.define('settings', function() {
var sections = Polymer.dom(
this.node.root).querySelectorAll('settings-section');
for (var i = 0; i < sections.length; i++)
- sections[i].hidden = !visible;
+ sections[i].hiddenBySearch = !visible;
},
};
« no previous file with comments | « no previous file | chrome/browser/resources/settings/settings_page/settings_section.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698