Here's the parseFunction
Ajax:
{
ParseHTML: function(aHTMLString)
{
var html = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null),
body = document.createElementNS("http://www.w3.org/1999/xhtml", "body");
html.documentElement.appendChild(body);
body.appendChild(Components.classes["@mozilla.org/feed-unescapehtml;1"]
.getService(Components.interfaces.nsIScriptableUnescapeHTML)
.parseFragment(aHTMLString, false, null, body));
return body;
}
}
Here I'm trying to use the parse in a http response (to sanatize the code):
var newdoc = Ajax.ParseHTML(o.responseText);
But, when I try to use:
newdoc.getElementById('teste');
It returns me the error: TypeError: newdoc.getElementById is not a function
Am I doing somthing wrong? It has something to do with documentType or something?
Also, this function removes all href=""
attributes in a
tags for example, maybe the problems are related ...