I have implemented a feature for dojo rich text.I got to an issue that causing the invaild argument error in IE7.However,it can work well in firefox.Could anyone please see why causing this issue?Maybe the textNode object bring this issue or because of the dojo rich text is an frame?

The scripts as bellows:
function findAndReplaceWord(word){
var currentNode = hiliteWords[currentNodeIndex];
var textNode = dojo.doc.createTextNode(word);
currentNode.parentNode.replaceChild(textNode,currentNode);//causing the error line
textNode = null;

Thank you very much!