Firefox API to replace text with HTML - Mozilla

This is a discussion on Firefox API to replace text with HTML - Mozilla ; Hi,
Is there any Firefox API to replace a word say: "Hello" with something like
" Hello ";
Thanks,
Priyank Bolia
http://priyank.co.in...

Re: Firefox API to replace text with HTML

Basically I have a list of 4200 GRE words, and I want to write an extension,
that whenever any GRE word is found it has to be highlighted and in the
tooltip its meaning has to be set.
If I just blindly replace innerHTML the whole page will be messed.
If I do dom parsing and replace so many nodes, the firefox crashes.
This is what I wrote:
function walk(node)
{
var highlightWords =
GREVocabulary_ext_prefs.getBoolPref(highlightGREWo rds_prefName);
var highlightColor =
GREVocabulary_ext_prefs.getCharPref(highlightColor _prefName);
if(node.childNodes.length > 0)
{
for(var i = 0; i < node.childNodes.length; i++)
{
if(node.childNodes[i].nodeName != "IMG" &&
node.childNodes[i].nodeName != "A" && node.childNodes[i].nodeName != "FONT")
walk(node.childNodes[i]);
}
}