From 6f349c9142e436d6c7447c0a2ab108803ba431f8 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 23 Dec 2021 17:09:13 +0100 Subject: [PATCH] luci.js: remove unsafe fallback code from dom.parse() Do not fallback to .innerHTML if DOMParser() failed for whatever reason. Signed-off-by: Jo-Philipp Wich (cherry picked from commit 63d9bcb6825fac92fd7dfa4ba858c8d5aafa23e8) --- .../luci-base/htdocs/luci-static/resources/luci.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js index c0e8b15a56..8f8b9673d6 100644 --- a/modules/luci-base/htdocs/luci-static/resources/luci.js +++ b/modules/luci-base/htdocs/luci-static/resources/luci.js @@ -1247,7 +1247,7 @@ * `null` on parsing failures or if no element could be found. */ parse: function(s) { - var elem; + var elem = null; try { domParser = domParser || new DOMParser(); @@ -1255,16 +1255,7 @@ } catch(e) {} - if (!elem) { - try { - dummyElem = dummyElem || document.createElement('div'); - dummyElem.innerHTML = s; - elem = dummyElem.firstChild; - } - catch (e) {} - } - - return elem || null; + return elem; }, /** -- 2.30.2