From 95997b67578d2231fe666367454650e62f06a750 Mon Sep 17 00:00:00 2001 From: tsv2013 <tsv2013@noreply.github.com> Date: Mon, 24 Jun 2024 10:26:15 +0300 Subject: [PATCH] Try to fix tests --- src/question.ts | 4 ++-- src/utils/utils.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/question.ts b/src/question.ts index 6d7bd119ec..d9d1d2972c 100644 --- a/src/question.ts +++ b/src/question.ts @@ -2526,7 +2526,7 @@ export class Question extends SurveyElement<Question> if (!!el && this.isDefaultRendering()) { const scrollableSelector = this.getObservedElementSelector(); if (!scrollableSelector) return; - const defaultRootEl: HTMLElement = el.querySelector(scrollableSelector) || el.matches(scrollableSelector) && el; + const defaultRootEl: HTMLElement = el.querySelector(scrollableSelector) || el as any != window && el.matches(scrollableSelector) && el; if (!defaultRootEl) return; let isProcessed = false; let requiredWidth: number = undefined; @@ -2537,7 +2537,7 @@ export class Question extends SurveyElement<Question> isProcessed = false; } const callback = () => { - const rootEl: HTMLElement = el.querySelector(scrollableSelector) || el.matches(scrollableSelector) && el; + const rootEl: HTMLElement = el.querySelector(scrollableSelector) || el as any != window && el.matches(scrollableSelector) && el; if (!requiredWidth && this.isDefaultRendering()) { requiredWidth = rootEl.scrollWidth; } diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 126c933b41..9d3877f671 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -331,7 +331,7 @@ function classesToSelector(str: string): string { } function getElementWidth(el: HTMLElement) { - return el as any != window && !!getComputedStyle ? Number.parseFloat(getComputedStyle(el).width) : el.offsetWidth; + return !!getComputedStyle ? Number.parseFloat(getComputedStyle(el).width) : el.offsetWidth; } function isContainerVisible(el: HTMLElement) {