I have the following string:
var songlist = '
Mama Tried
Blue Eyes Crying In the Rain
Which I am converting to a NodeList through this custom function:
var toDom = function(str) {
var tmp = document.createElement("div");
tmp.innerHTML = str;
return tmp.childNodes;
};
console.log(toDom(songlist)) outputs NodeList [
When I try to append the collection to a node...
document.getElementById("app-data").appendChild(toDom(songlist));
I get TypeError: Argument 1 of Node.appendChild does not implement interface Node. Which is odd, because the docs for Node.appendChild() say that argument 1 must be of type Node.
So, what type of element does Node.appendChild() expect? I've also tried HTMLCollection.