From 7f09156b92626ba5f6208de6579ec8c004f8d23d Mon Sep 17 00:00:00 2001 From: Andrei Kharitonov Date: Mon, 30 Nov 2026 14:18:22 +0100 Subject: [PATCH] Navigation: fix label text during the web font check in Material themes (T1338847) (#36640) --- packages/devextreme/js/ui/themes.js | 2 +- .../tests/DevExpress.ui/themes.tests.js | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/devextreme/js/ui/themes.js b/packages/devextreme/js/ui/themes.js index 5a3409572fd3..c01192c7f870 100644 --- a/packages/devextreme/js/ui/themes.js +++ b/packages/devextreme/js/ui/themes.js @@ -366,7 +366,7 @@ export function isWebFontLoaded(text, fontWeight) { testElement.style.fontFamily = etalonFont; testElement.style.fontSize = '250px'; testElement.style.fontWeight = fontWeight; - testElement.innerHTML = text; + testElement.textContent = text; document.body.appendChild(testElement); diff --git a/packages/devextreme/testing/tests/DevExpress.ui/themes.tests.js b/packages/devextreme/testing/tests/DevExpress.ui/themes.tests.js index 00774caf5af9..33db7665b9a8 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui/themes.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui/themes.tests.js @@ -676,6 +676,26 @@ QUnit.module('web font checker', () => { assert.equal(diff, 0, 'Element\'s count are the same after method call'); }); + [ + '', + '<img src=x onerror=alert(1)>', + ].forEach((text) => { + test(`isWebFontLoaded measures "${text}" as plain text`, function(assert) { + const appendChild = sinon.spy(document.body, 'appendChild'); + + try { + themes.isWebFontLoaded(text, 400); + + const element = appendChild.getCall(0).args[0]; + + assert.strictEqual(element.children.length, 0, 'no elements are created from the text'); + assert.strictEqual(element.textContent, text, 'text is kept as it is'); + } finally { + appendChild.restore(); + } + }); + }); + testInActiveWindow('waitWebFont: function resolve by timeout if the font is not loaded', function(assert) { const done = assert.async(); themes.waitWebFont('test text', 400).then((success) => {