[Greasemonkey] Alternative to innerHTML?

Lenny Domnitser ldrhcp at gmail.com
Fri Jul 29 11:40:10 EDT 2005


On 7/28/05, Edward Lee <edilee at gmail.com> wrote:
> document.body.appendChild((new DOMParser()).parseFromString('<a
> href="."><b>H</b><i>i</i></a>', 'text/xml').childNodes[0])
> 
> It does indeed add the text.. but no styling of the anchor, bold, italics.

You're parsing an XML document--don't forget the namespace.

document.body.appendChild((new DOMParser()).parseFromString('<a
xmlns="http://www.w3.org/1999/xhtml" href="."><b>H</b><i>i</i></a>',
'text/xml').childNodes[0])


More information about the Greasemonkey mailing list