Do not fallback to .innerHTML if DOMParser() failed for whatever reason.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* `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;
},
/**