User:Mike Dillon/Scripts/easydom.js: Difference between revisions

Content deleted Content added
enhance the appendChild method of the DOM nodes created by easyDOM to automatically wrap string in text nodes
m don't try to be too tricky
Line 10:
 
// Make appendChild automatically wrap string in a text node
var superorigAppendChild = {elem.appendChild;
"appendChild": elem.appendChild
};
elem.appendChild = function (child) {
if (typeof child == stringType) {
child = document.createTextNode(child);
}
super.appendChildorigAppendChild(child);
};