Error: WRONG_DOCUMENT_ERR: DOM Exception 4 http://pastie.org/259289 (line 59) I could be wrong (I'm a noob to this stuff), but I believe this has something to do with trying to refer to the 'document' object in JavaScript with embedded SVG within an XHTML document (true XHTML, with proper markup and served as application/xhtml+xml).
After some more debugging, I find that the line causing the error is in fact line 59 of this slightly modified test case: http://pastie.org/259289 So it has something to do with appendChild, though I'm still not sure exactly what.
Created attachment 22976 [details] test case Attaching the same test as an attachment. It is not immediately obvious whether this is a bug or just a difference with Firefox. In any case, you can probably work around this by using importNode to ensure that the nodes are in the same document.
(In reply to comment #2) > It is not immediately obvious whether this is a bug or just a difference with > Firefox. In any case, you can probably work around this by using importNode to > ensure that the nodes are in the same document. Not sure about that - trying to debug the same original code in FireFox as well, right now, causes other, even weirder errors there ("[Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMHTMLDocument.importNode]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://geoffrey.elliottcable.name/board/4/game_board_4.xhtml :: writeSVG :: line 355" data: no]"? What does that even _mean_?)
Another thing worth pointing out is that FireFox chokes up on the use of ( new DOMParser() ).parseFromString(svgSource, "text/xml") when the source is SVG - it returns XML objects, not the SVG objects that it actually uses internally for SVG elements. Thus there's problems with XML/SVG documents and using that - perhaps there's a similar problem going on under the hood here?
Mass moving XML DOM bugs to the "DOM" Component.