I'm trying to fix a bug in a rich text editor I'm using, which causes <embed>
tags to be inserted without their closing tag (which screws the output up completely). I've isolated the problem to this operation:
// body is a <body> tag
body.innerHTML = '<embed src="http://example.com/whatever"></embed>';
No fancy code, just Firefox's innerHTML
assignment. You should be able to duplicate the error in Firebug like so:
>>> document.body.innerHTML = "<embed></embed>"
"<embed></embed>"
>>> document.body.innerHTML
"<embed>"
Is there a workaround for this? I need the tag, but I can't justify rebuilding/replacing the entire rich text editor because of one crappy edge case.
I can't convert this to something like document.createElement('embed')
, because real-world input to this editor can easily include a few paragraphs of text wrapped around the <embed>
; innerHTML is, on paper, perfect for this use case, I just can't get it to work with an <embed>
.