function feed_fetch(){
const div = document.getElementById('feed');
div.innerHTML = "";
const url = "https://some-rss-url";
fetch(url)
.then(response => response.text())
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
.then(data => {
const items = data.querySelectorAll("item");
items.forEach(item => {
const html = `
<article>
<h3>
<a href="${item.querySelector("link").innerHTML}" target="_blank" rel="noopener">
${item.querySelector("title").innerHTML}
</a>
</h3>
</article>
`;
div.innerHTML += html;
})
});
}
The results of the fetch includes some CData such as <![CDATA[ "some text" ]]>.
In the resulting HTML generated, the parts inside CDATA do not appear. If I manually remove the CDATA enveloppe it works.
I could just find/replace the enveloppe. However is there a correct way of handling this?