Hi,
I want to automatically set up abbreviation tags everywhere in my
document, and it works great, except I am altering the innerHTML to do
so and sometimes some crazy results happen.  For instance, an input's
value should be untouched because the value should not be value="<abbr
title='united states of america'>USA</abbr>"

I believe the way to go would be to select for textnodes but I cannot
figure out why that wouldn't work.  Anyway, any help to fix my code
would be appreciated (I hope the indentation is preserved when I post
this).

// find and add in abbr all over the place!
var replacing={
                'TSV':'Tab-Separated Values',
                'CSV':'Comma-Separated Values',
               'STs?':'Sequence Type',
               'CCs?':'Clonal Complex',
               'MGIP':'Meningococcus Genome Informatics Platform',
               'MLST':'Multilocus Sequence Typing',
               'GIT':'Georgia Institute of Technology',
               'CDC':'Centers for Disease Control and Prevention',
               'OMP':'Outer Membrane Protein'
            };
$$('.systemMessage, .body p,.body
div,label,h1,h2,h3,h4,.menu.firefox').each(function(el){
  if(el.hasClassName('doNotDisturb')){
    return; // equivalent to a continue inside of an each loop
  }
  el.select('text').each(function(s){
    debug('textNode: '+s);
  });
  for(var k in replacing){
    var v=replacing[k];
        var find=new RegExp('\\b('+k+')\\b','g');
        // I should use something like innerContext or innerText
instead of innerHTML
        el.update(el.innerHTML.replace(find,"<acronym title='"+v+"'>
$1</acronym>",''));
   }
});

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to