From: Jo-Philipp Wich Date: Thu, 23 Dec 2021 16:09:13 +0000 (+0100) Subject: luci.js: remove unsafe fallback code from dom.parse() X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=b3cd4735174db053fd30df097be09bd2c8992d9f;p=project%2Fluci.git 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) --- diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js index 23853e2cc8..b06688ea29 100644 --- a/modules/luci-base/htdocs/luci-static/resources/luci.js +++ b/modules/luci-base/htdocs/luci-static/resources/luci.js @@ -1248,7 +1248,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(); @@ -1256,16 +1256,7 @@ } catch(e) {} - if (!elem) { - try { - dummyElem = dummyElem || document.createElement('div'); - dummyElem.innerHTML = s; - elem = dummyElem.firstChild; - } - catch (e) {} - } - - return elem || null; + return elem; }, /**