The issue is that when the caption is created it has no firstchild. So t.caption.firstChild is null, and the js fails. Adding t.caption.appendChild(document.createTextNode("")); right before t.caption.firstChild.nodeValue="This is the new caption text."; makes the testcase work the way it should. If all createCaption() does is create a new caption element, this is the correct behavior....
doh! My bad, thanks Boris! Marking invalid.
QA contact Update