diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-12-23 17:09:13 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-12-23 17:09:13 +0100 |
commit | 63d9bcb6825fac92fd7dfa4ba858c8d5aafa23e8 (patch) | |
tree | a833d9d46f01f254b0a23cabb197123092db5bad /modules/luci-base/htdocs/luci-static/resources | |
parent | 993151504e8e810c083d3257555bdcdc2f00673a (diff) |
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 <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/luci.js | 13 |
1 files 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 fcab3a4018..78e8b8b30b 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; }, /** |