When I was testing the DOM handling of the XML processing instructions in various browsers, I've found an interesting inconsistency: Internet Explorer includes the <?xml ?> processing instruction in the DOM tree, while Firefox hides it.
For example, when the following XML document ...
For example, when the following XML document ...
<?xml version="1.0" encoding="windows-1250"?>... is transformed into a DOM tree and processed with this JavaScript function:
<?xml-stylesheet href="countryPage.xsl" type="text/xsl"?>
<Test />
function testPI(dom) {... Internet Explorer generates the following text:
var topNodes = dom.childNodes;
for (var i = 0; i < topNodes.length; i++) {
var node = topNodes[i];
wr("nodeType="+node.nodeType);
if (node.nodeType == 7) {
wr("PI="+node.target+" ... "+node.data);
}
}
nodeType=7... while Firefox skips the <?xml ?> processing instruction:
PI=xml ... version="1.0" encoding="windows-1250"
nodeType=7
PI=xml-stylesheet ... href="countryPage.xsl" type="text/xsl"
nodeType=1
nodeType=7
PI=xml-stylesheet ... href="countryPage.xsl" type="text/xsl"
nodeType=1
No comments:
Post a Comment