summaryrefslogtreecommitdiff
path: root/test/dom-text-scanner.test.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-02-14 22:26:29 -0500
committerGitHub <noreply@github.com>2024-02-15 03:26:29 +0000
commit6bf7b0055765c4f2011c9614753d6714dc09be65 (patch)
tree0e782ae66556eaa61a34d9f32d77c831b2443ce5 /test/dom-text-scanner.test.js
parent7a4096240ce4faf70a785d047945388baa0daab3 (diff)
Eslint rule updates (#673)
* Install unicorn * Add rules * Fix issues * Install sonarjs * Set up rules * Fix issues * Install eslint-plugin-import and fix import extensions * Simplify permitted error names
Diffstat (limited to 'test/dom-text-scanner.test.js')
-rw-r--r--test/dom-text-scanner.test.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/test/dom-text-scanner.test.js b/test/dom-text-scanner.test.js
index e86d2980..1ec7cab7 100644
--- a/test/dom-text-scanner.test.js
+++ b/test/dom-text-scanner.test.js
@@ -34,7 +34,7 @@ function querySelectorTextNode(element, selector) {
let textIndex = -1;
const match = /::text$|::nth-text\((\d+)\)$/.exec(selector);
if (match !== null) {
- textIndex = (match[1] ? parseInt(match[1], 10) - 1 : 0);
+ textIndex = (match[1] ? Number.parseInt(match[1], 10) - 1 : 0);
selector = selector.substring(0, selector.length - match[0].length);
}
const result = element.querySelector(selector);
@@ -67,13 +67,11 @@ function getComputedFontSizeInPixels(window, getComputedStyle, element) {
if (element.nodeType === window.Node.ELEMENT_NODE) {
const fontSize = getComputedStyle(/** @type {Element} */ (element)).fontSize;
if (fontSize.endsWith('px')) {
- const value = parseFloat(fontSize.substring(0, fontSize.length - 2));
- return value;
+ return Number.parseFloat(fontSize.substring(0, fontSize.length - 2));
}
}
}
- const defaultFontSize = 14;
- return defaultFontSize;
+ return 14; // Default font size
}
/**
@@ -92,7 +90,7 @@ function createAbsoluteGetComputedStyle(window) {
if (typeof result === 'string') {
result = result.replace(/([-+]?\d(?:\.\d)?(?:[eE][-+]?\d+)?)em/g, (g0, g1) => {
const fontSize = getComputedFontSizeInPixels(window, getComputedStyleOld, element);
- return `${parseFloat(g1) * fontSize}px`;
+ return `${Number.parseFloat(g1) * fontSize}px`;
});
}
return result;