From 67223bfb82338c030f38dac03f12c73b7b3d760f Mon Sep 17 00:00:00 2001 From: Yurii Date: Wed, 10 Jun 2026 20:27:17 +0300 Subject: [PATCH] Fix interator variable --- client/src/view-helper.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/client/src/view-helper.js b/client/src/view-helper.js index 63dada36bc..0e222367e4 100644 --- a/client/src/view-helper.js +++ b/client/src/view-helper.js @@ -901,10 +901,11 @@ class ViewHelper { * @returns {string} */ stripEventHandlersInHtml(html) { - let j; // @todo Revise. + let j; function stripHTML() { html = html.slice(0, strip) + html.slice(j); + j = strip; strip = false; @@ -921,7 +922,7 @@ class ViewHelper { if (html[i] === '<' && html[i + 1] && isValidTagChar(html[i + 1])) { i++; - for (let j = i; j < html.length; j++){ + for (j = i; j < html.length; j++){ if (!lastQuote && html[j] === '>'){ if (strip) { stripHTML(); @@ -943,11 +944,21 @@ class ViewHelper { lastQuote = html[j]; } - if (!lastQuote && html[j - 2] === " " && html[j - 1] === "o" && html[j] === "n") { + + if ( + !lastQuote && + (html[j - 2] === " " || html[j - 2] === "/") && + html[j - 1] === "o" && + html[j] === "n" + ) { strip = j - 2; } - if (strip && html[j] === " " && !lastQuote){ + if ( + strip !== false && + (html[j] === " ") && + !lastQuote + ) { stripHTML(); } }