« Gates[1] = 'Ray Ozzie' | Main | e4xDOM »

Comments

Jeremy French

Isn't this throwing the baby out with the bathwater a little.

function writeList(){
var xdoc = new XML((new XMLSerializer()).serializeToString(xmlDoc.documentElement));
var xlist = ;
for each (label in xdoc..label){
xlist.* += {label.name.text() + ' (' + label.@id + ')'};
}
var domNode = new DOMParser().parseFromString(xlist.toXMLString(),"text/xml").documentElement;
document.getElementById('updateTarget').appendChild(domNode);
}

Will do the same job and not rely on innerHTML.

Dan Sickles

Jeremy, you are correct. I was trying to minimize DOM usage under the assumption that Brendan and his javascript gurus will atually implement the e4x<>DOM integration someday. Then all the serialzing and parsing goes away. But yes, innerHTML is the greater of two evils so a little DOM code to make it go away is a win.

The comments to this entry are closed.