#1487 MutationObserver - small performance FIX

This commit is contained in:
Greg Zajac 2024-01-31 19:31:24 +01:00
parent 734f019328
commit fd3d4be9bb
2 changed files with 13 additions and 5 deletions

View File

@ -19,15 +19,17 @@
const buttonsTexts = require('../../partials/buttonsTexts');
const ignoreButtonTexts = require('../../partials/ignoreButtonTexts');
const formSubmitSelectors = require('../../partials/formSubmitSelectors');
const formSubmitSecondSelectors = require('../../partials/formSubmitSecondSelectors');
const getFormSubmitElements = () => {
let submits = Array.from(
document.querySelectorAll(require('../../partials/formSubmitSelectors')())
document.querySelectorAll(formSubmitSelectors())
);
if (submits.length <= 0) {
submits = Array.from(
document.querySelectorAll(require('../../partials/formSubmitSecondSelectors')())
document.querySelectorAll(formSubmitSecondSelectors())
);
}

View File

@ -17,12 +17,18 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>
//
const inputsSelectors = require('../../partials/inputsSelectors');
let i = 0;
const getInputs = (node = null) => {
const el = node || document;
return Array.from(
el.querySelectorAll(require('../../partials/inputsSelectors')())
);
console.time(i);
const r = Array.from(el.querySelectorAll(inputsSelectors()));
console.timeEnd(i);
i++;
return r;
};
module.exports = getInputs;