luci.js: remove unsafe fallback code from dom.parse()
authorJo-Philipp Wich <jo@mein.io>
Thu, 23 Dec 2021 16:09:13 +0000 (17:09 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 23 Dec 2021 16:09:13 +0000 (17:09 +0100)
Do not fallback to .innerHTML if DOMParser() failed for whatever reason.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/luci.js

index fcab3a4018542190c8776495924d11170fb3dd0c..78e8b8b30bb010f6c409556a6efd75cffe1dcbaa 100644 (file)
                 * `null` on parsing failures or if no element could be found.
                 */
                parse: function(s) {
-                       var elem;
+                       var elem = null;
 
                        try {
                                domParser = domParser || new DOMParser();
                        }
                        catch(e) {}
 
-                       if (!elem) {
-                               try {
-                                       dummyElem = dummyElem || document.createElement('div');
-                                       dummyElem.innerHTML = s;
-                                       elem = dummyElem.firstChild;
-                               }
-                               catch (e) {}
-                       }
-
-                       return elem || null;
+                       return elem;
                },
 
                /**