Use optimal DOM selection functions

Reverts part of 7046d48cf9d574
This commit is contained in:
Rob Garrison 2017-08-23 07:37:35 -05:00
parent 8dc2115347
commit 487bb53145
3 changed files with 4 additions and 4 deletions

View File

@ -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 // display a full text tooltip on buttons with ellipsis overflow and no inherent title
const addTooltipsToEllipsized = () => { const addTooltipsToEllipsized = () => {
for (const btn of $$('button')) { for (const btn of document.getElementsByTagName('button')) {
if (btn.title && !btn.titleIsForEllipsis || if (btn.title && !btn.titleIsForEllipsis ||
btn.clientWidth === btn.preresizeClientWidth) { btn.clientWidth === btn.preresizeClientWidth) {
continue; continue;

View File

@ -30,7 +30,7 @@ function tHTML(html, tag) {
} }
const body = t.DOMParser.parseFromString(html, 'text/html').body; const body = t.DOMParser.parseFromString(html, 'text/html').body;
if (html.includes('i18n-')) { if (html.includes('i18n-')) {
tNodeList($$('*', body)); tNodeList(body.getElementsByTagName('*'));
} }
// the html string may contain more than one top-level node // the html string may contain more than one top-level node
if (!body.childNodes[1]) { if (!body.childNodes[1]) {
@ -115,7 +115,7 @@ function tDocLoader() {
const cacheLength = Object.keys(t.cache).length; const cacheLength = Object.keys(t.cache).length;
// localize HEAD // localize HEAD
tNodeList($$('*')); tNodeList(document.getElementsByTagName('*'));
// localize BODY // localize BODY
const process = mutations => { const process = mutations => {

View File

@ -301,7 +301,7 @@ function showFiltersStats({immediately} = {}) {
} }
$('#filters').classList.toggle('active', filtersSelector.hide !== ''); $('#filters').classList.toggle('active', filtersSelector.hide !== '');
const numTotal = BG.cachedStyles.list.length; 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); const numShown = Math.min(numTotal - numHidden, installed.children.length);
if (filtersSelector.numShown !== numShown || if (filtersSelector.numShown !== numShown ||
filtersSelector.numTotal !== numTotal) { filtersSelector.numTotal !== numTotal) {