+ const URI = el ? htmlDecode(el.innerHTML) : defaultValue;
+
+ if (!skipDecoding) {
+ try {
+ return customDecodeURI(URI);
+ } catch(e) {}
+ }
+
+ return URI;
+};
+
+const htmlDecode = (input: string) => {
+ const out = input.split(' ').map((i) => {
+ const doc = new DOMParser().parseFromString(i, "text/html");
+ if (doc.documentElement !== null) {
+ return doc.documentElement.textContent || '';
+ }
+ return '';
+ });
+ return out.join(' ');