• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2020 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Note: Be sure that this file is only included inside a CDATA block,
6// otherwise the less-than comparision below will break the XML parse.
7
8function dumpTree(node, level) {
9  level = level || 0;
10  var indentation = "| ".repeat(level);
11  try {
12    app.alert(indentation + node.className);
13    var children = node.nodes;
14    if (children) {
15      for (var i = 0; i < children.length; ++i) {
16        dumpTree(children.item(i), level + 1);
17      }
18    }
19  } catch (e) {
20    app.alert(indentation + "Error: " + e);
21  }
22}
23