my code is:
function htmlEncode (str){
var div = document.createElement("div");
div.textContent=str;
return div.innerHTML;
}
it can work well in other page, but not work in xul,who can help me?
UPDATE:
Answer is:
function htmlEncode (str){
var div = document.createElementNS("http://www.w3.org/1999/xhtml","div");
div.textContent=str;
return div.innerHTML;
}
I believe you have to use document.createElementNS instead.