File size: 497 Bytes
bd98362 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | function walk(node) {
'use strict';
var child, next;
switch (node.nodeType){
case 1:
case 9:
case 11:
child = node.firstChild;
while (child) {
next = child.nextSibling;
walk(child);
child = next;
}
break;
case 3:
var assmar = node.nodeValue;
assmar = assmar.replace(/asthma/g, 'ass-mar');
assmar = assmar.replace(/Asthma/g, 'Ass-mar');
assmar = assmar.replace(/ASTHMA/g, 'ASS-MAR');
node.nodeValue = assmar;
break;
}
}
walk(document.body); |