diff options
Diffstat (limited to 'ext/dom/tests/dom_test.inc')
-rw-r--r-- | ext/dom/tests/dom_test.inc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/dom/tests/dom_test.inc b/ext/dom/tests/dom_test.inc index 93264ea2aa..04bfa04d53 100644 --- a/ext/dom/tests/dom_test.inc +++ b/ext/dom/tests/dom_test.inc @@ -48,4 +48,22 @@ function print_node_list($nodelist) } } +function print_node_compact($node, $spaces) +{ + if ($node->nodeType == 3) { + print str_repeat(" ", $spaces) . trim($node->nodeValue) . "\n"; + } else { + print str_repeat(" ", $spaces) . "<" . $node->nodeName . ">\n"; + print_node_list_compact($node->childNodes, $spaces + 2); + print str_repeat(" ", $spaces) . "</" . $node->nodeName . ">\n"; + } +} + +function print_node_list_compact($nodelist, $spaces = 0) +{ + foreach ($nodelist as $node) { + print_node_compact($node, $spaces); + } +} + ?> |