Mozilla/mozilla/dom/tests/js/DumpTree.js
kipp fb1503758e moved to pub
git-svn-id: svn://10.0.0.236/trunk@165 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-13 20:24:54 +00:00

34 lines
805 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function travers(node, indent)
{
Dump("\n")
indent += " "
var type = node.GetNodeType()
if (type == 2) {
Dump(indent + node.GetTagName())
if (node.HasChildNodes()) {
var children = node.GetChildNodes()
var length = children.GetLength()
//Dump("\n"+indent+length)
var child = children.GetNextNode()
var count = 0;
while(count < length) {
//Dump("\n"+indent+"**"+count)
travers(child, indent)
child = children.GetNextNode()
count++
}
}
}
else if (type == 6) {
//Dump("\n"+indent+"Text")
Dump(indent + "Text")
}
}
var node = document.documentElement
travers(node, "")
Dump("\n")