The code:
$each(nodes.getElementsByTagName("node")), function(node, index) {
alert(node.getAttribute("value"));
});
Using that code with the following xml: <nodes></nodes> will generate
an error on IE at mootools function $type at line else if (obj.item)
return 'collection', with error "wrong number of arguments".
Same with <nodes><node value="1"/></nodes>
But not with <nodes><node value="1"/><node value="2"/></nodes>
Error is because the of nodes.getElementsByTagName("node") can not be
determine correctly
by $type.
The solution was to create the following function:
function xmlElementsToArray(elements) {
var result = new Array();
for (var i = 0; i < elements.length; i++) {
result.include(elements[i]);
}
return result;
}
and do:
$each(xmlElementsToArray(nodes.getElementsByTagName("node"))),
function(node, index) {
alert(node.getAttribute("value"));
});
Did anyone had the same problem?? What was the solution?
Thanks in advance