diff --git a/rsspreview.js b/rsspreview.js
index a6a6665..d04679b 100644
--- a/rsspreview.js
+++ b/rsspreview.js
@@ -72,38 +72,37 @@
let tohtml = el.getElementsByClassName('feedRawContent');
for (let i = 0; i < tohtml.length; i++) {
- // in case of xhtml the content is already parsed
- if (tohtml[i].getAttribute('desctype') != 'xhtml') {
- try {
- let html_txt = '';
- if (tohtml[i].getAttribute('desctype') == 'text/plain') {
- html_txt = '
' + tohtml[i].innerHTML + '
';
- }
- else {
- html_txt = '' + tohtml[i].innerText + '
';
- }
+ try {
- let html_desc = html_parser.parseFromString(html_txt, 'text/html');
- let xml_desc = xml_parser.serializeToString(
- html_desc.body.firstChild
- );
-
- tohtml[i].insertAdjacentHTML('afterend', xml_desc);
- tohtml[i].setAttribute('todel', 1);
- } catch (e) {
- console.error(e);
- console.log(tohtml[i].innerHTML);
+ let html_txt = '';
+ if (tohtml[i].getAttribute('desctype') == 'text/plain') {
+ html_txt = '' + tohtml[i].innerHTML + '
';
}
+ else if (tohtml[i].getAttribute('desctype') == 'xhtml') {
+ html_txt = '' + tohtml[i].innerHTML + '
';
+ }
+ else {
+ html_txt = '' + tohtml[i].innerText + '
';
+ }
+
+ let html_desc = html_parser.parseFromString(html_txt, 'text/html');
+ let xml_desc = xml_parser.serializeToString(
+ html_desc.body.firstChild
+ );
+
+ tohtml[i].insertAdjacentHTML('afterend', xml_desc);
+ tohtml[i].setAttribute('todel', 1);
+ } catch (e) {
+ console.error(e);
+ console.log(tohtml[i].innerHTML);
}
+
}
el.querySelectorAll('.feedRawContent').forEach(a => {
if (a.getAttribute('todel') == '1') {
a.remove();
- } else if (a.getAttribute('desctype') == 'xhtml') {
- a.classList.add('feedEntryContent');
- a.classList.remove('feedRawContent');
}
});
}