From 487bb53145f7088188eb93bf95d50de57e1545e3 Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Wed, 23 Aug 2017 07:37:35 -0500 Subject: [PATCH] Use optimal DOM selection functions Reverts part of 7046d48cf9d574 --- js/dom.js | 2 +- js/localization.js | 4 ++-- manage/filters.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/dom.js b/js/dom.js index 0f897552..c56a2b4b 100644 --- a/js/dom.js +++ b/js/dom.js @@ -14,7 +14,7 @@ for (const type of [NodeList, NamedNodeMap, HTMLCollection, HTMLAllCollection]) { // display a full text tooltip on buttons with ellipsis overflow and no inherent title const addTooltipsToEllipsized = () => { - for (const btn of $$('button')) { + for (const btn of document.getElementsByTagName('button')) { if (btn.title && !btn.titleIsForEllipsis || btn.clientWidth === btn.preresizeClientWidth) { continue; diff --git a/js/localization.js b/js/localization.js index 27ec14ed..0065d22c 100644 --- a/js/localization.js +++ b/js/localization.js @@ -30,7 +30,7 @@ function tHTML(html, tag) { } const body = t.DOMParser.parseFromString(html, 'text/html').body; if (html.includes('i18n-')) { - tNodeList($$('*', body)); + tNodeList(body.getElementsByTagName('*')); } // the html string may contain more than one top-level node if (!body.childNodes[1]) { @@ -115,7 +115,7 @@ function tDocLoader() { const cacheLength = Object.keys(t.cache).length; // localize HEAD - tNodeList($$('*')); + tNodeList(document.getElementsByTagName('*')); // localize BODY const process = mutations => { diff --git a/manage/filters.js b/manage/filters.js index 007f2953..8d96b601 100644 --- a/manage/filters.js +++ b/manage/filters.js @@ -301,7 +301,7 @@ function showFiltersStats({immediately} = {}) { } $('#filters').classList.toggle('active', filtersSelector.hide !== ''); const numTotal = BG.cachedStyles.list.length; - const numHidden = $$('.entry.hidden', installed).length; + const numHidden = installed.getElementsByClassName('entry hidden').length; const numShown = Math.min(numTotal - numHidden, installed.children.length); if (filtersSelector.numShown !== numShown || filtersSelector.numTotal !== numTotal) {