Say,is the following possible:
textNode.appendChild(elementNode);
elementNode refers to those with nodeType=1
textNode refers to those with nodeType=2
It's not easy to produce.
The reason I ask this is that I find a function that adds a cite link to the end of a quotation:
function displayCitations() {
var quotes = document.getElementsByTagName("blockquote");
for (var i=0; i<quotes.length; i++) {
if (!quotes[i].getAttribute("cite")) continue;
var url = quotes[i].getAttribute("cite");
var quoteChildren = quotes[i].getElementsByTagName('*');
if (quoteChildren.length < 1) continue;
var elem = quoteChildren[quoteChildren.length - 1];
var link = document.createElement("a");
var link_text = document.createTextNode("source");
link.appendChild(link_text);
link.setAttribute("href",url);
var superscript = document.createElement("sup");
superscript.appendChild(link);
elem.appendChild(superscript);
}
}
see the last line "elem.appendChild(superscript);" where elem can be a textNode?
I think the reason it's difficult to prove it because it's hard to get access to a specified textNode.Have anyone any way to achieve that?