Thanks to Alexis Deveria. (Though I did fix one small bug.) My patch-file is now down to a mere 178 lines (a big chunk of which is Revision 569). Also, the font-size for foreignObjects defaults to 16pt, which will be more useful in Instiki.
Thanks to Jeff Schiller for tracking down the problem (and committing preliminary MathML support to SVG-Edit).