User:Interiot/js/RealTitle.js: Difference between revisions

Content deleted Content added
+improved comment
+innerText
Line 13:
var realTitle = document.getElementById("RealTitle");
if (realTitle) {
realTitle = pickUpText(realTitle.innerHTML); // TODO: replace this with something like "realText"
var isPasteable = 0;
Line 47:
}
});
 
 
// similar to innerHTML, but only returns the text portions of the insides, excludes HTML
function pickUpText(aParentElement) {
var str = "";
 
function pickUpTextInternal(aElement) {
var child = aElement.firstChild;
while (child) {
if (child.nodeType == Node.ELEMENT_NODE)
pickUpTextInternal(child);
else if (child.nodeType == Node.TEXT_NODE)
str += child.nodeValue;
 
child = child.nextSibling();
}
}
 
pickUpTextInternal(aParentElement);
 
return str;
}