summaryrefslogtreecommitdiffstats
path: root/dom/xslt/tests/buster/DumpDOM.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/xslt/tests/buster/DumpDOM.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/xslt/tests/buster/DumpDOM.js')
-rw-r--r--dom/xslt/tests/buster/DumpDOM.js85
1 files changed, 85 insertions, 0 deletions
diff --git a/dom/xslt/tests/buster/DumpDOM.js b/dom/xslt/tests/buster/DumpDOM.js
new file mode 100644
index 000000000..0a90ce9d0
--- /dev/null
+++ b/dom/xslt/tests/buster/DumpDOM.js
@@ -0,0 +1,85 @@
+// ----------------------
+// DumpDOM(node)
+//
+// Call this function to dump the contents of the DOM starting at the specified node.
+// Use node = document.documentElement to dump every element of the current document.
+// Use node = top.window.document.documentElement to dump every element.
+//
+// 8-13-99 Updated to dump almost all attributes of every node. There are still some attributes
+// that are purposely skipped to make it more readable.
+// ----------------------
+function DumpDOM(node)
+{
+ dump("--------------------- DumpDOM ---------------------\n");
+
+ DumpNodeAndChildren(node, "");
+
+ dump("------------------- End DumpDOM -------------------\n");
+}
+
+
+// This function does the work of DumpDOM by recursively calling itself to explore the tree
+function DumpNodeAndChildren(node, prefix)
+{
+ dump(prefix + "<" + node.nodeName);
+
+ var attributes = node.attributes;
+
+ if ( attributes && attributes.length )
+ {
+ var item, name, value;
+
+ for ( var index = 0; index < attributes.length; index++ )
+ {
+ item = attributes.item(index);
+ name = item.nodeName;
+ value = item.nodeValue;
+
+ if ( (name == 'lazycontent' && value == 'true') ||
+ (name == 'xulcontentsgenerated' && value == 'true') ||
+ (name == 'id') ||
+ (name == 'instanceOf') )
+ {
+ // ignore these
+ }
+ else
+ {
+ dump(" " + name + "=\"" + value + "\"");
+ }
+ }
+ }
+
+ if ( node.nodeType == 1 )
+ {
+ // id
+ var text = node.getAttribute('id');
+ if ( text && text[0] != '$' )
+ dump(" id=\"" + text + "\"");
+ }
+
+ if ( node.nodeType == Node.TEXT_NODE )
+ dump(" = \"" + node.data + "\"");
+
+ dump(">\n");
+
+ // dump IFRAME && FRAME DOM
+ if ( node.nodeName == "IFRAME" || node.nodeName == "FRAME" )
+ {
+ if ( node.name )
+ {
+ var wind = top.frames[node.name];
+ if ( wind && wind.document && wind.document.documentElement )
+ {
+ dump(prefix + "----------- " + node.nodeName + " -----------\n");
+ DumpNodeAndChildren(wind.document.documentElement, prefix + " ");
+ dump(prefix + "--------- End " + node.nodeName + " ---------\n");
+ }
+ }
+ }
+ // children of nodes (other than frames)
+ else if ( node.childNodes )
+ {
+ for ( var child = 0; child < node.childNodes.length; child++ )
+ DumpNodeAndChildren(node.childNodes[child], prefix + " ");
+ }
+}