I found a GreaseMonkey script on Userscripts which corrects spelling and some grammar which I'm trying to improve for use on Reddit etc. I've had some help from there improving it, and this is my current version which does work quite well.
There is, however, a problem in that it capitalises italics, bold and links. I would like to have the script ignore all child nodes, or at least those which are em (italic), strong (bold) or a (link). I've tried a lot of searching and reading, but I've not yet found a way to do this. It seems that for other purposes everyone wants their script to work on children as well.
I imagine there are different ways of doing this - perhaps prevent it including them in the first place, strip them out straight after that, or prevent the replacement loop working on them if they meet some criteria. Unfortunately I'm not very experienced in javascript, hence why I'm asking here.