metajack / strophejs

The Strophe.js repository has moved to https://github.com/strophe/strophejs
http://strophe.im/strophejs
MIT License
810 stars 160 forks source link

copyElement will double escape XML #28

Closed nborko closed 12 years ago

nborko commented 13 years ago

If an element contains escaped XML in a text node, then copyElement will double escape the text at this point:

el = Strophe.xmlTextNode(elem.nodeValue);

A possible fix is to pass an optional flag to Strophe.xmlTextNode, such as the following:

xmlTextNode: function (text, isEscaped) { if (! isEscaped) { //ensure text is escaped text = Strophe.xmlescape(text); } ... }

And thus the call in copyElement would be:

el = Strophe.xmlTextNode(elem.nodeValue, true);

dodo commented 12 years ago

fixed in pull request 59.