aboutsummaryrefslogtreecommitdiff
path: root/test/dom-text-scanner.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/dom-text-scanner.test.js')
-rw-r--r--test/dom-text-scanner.test.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/dom-text-scanner.test.js b/test/dom-text-scanner.test.js
index 1ec7cab7..b366cadd 100644
--- a/test/dom-text-scanner.test.js
+++ b/test/dom-text-scanner.test.js
@@ -88,10 +88,16 @@ function createAbsoluteGetComputedStyle(window) {
get: (target, property) => {
let result = /** @type {import('core').SafeAny} */ (target)[property];
if (typeof result === 'string') {
- result = result.replace(/([-+]?\d(?:\.\d)?(?:[eE][-+]?\d+)?)em/g, (g0, g1) => {
+ /**
+ * @param {string} g0
+ * @param {string} g1
+ * @returns {string}
+ */
+ const replacer = (g0, g1) => {
const fontSize = getComputedFontSizeInPixels(window, getComputedStyleOld, element);
return `${Number.parseFloat(g1) * fontSize}px`;
- });
+ };
+ result = result.replace(/([-+]?\d(?:\.\d)?(?:[eE][-+]?\d+)?)em/g, replacer);
}
return result;
}