471,078 Members | 830 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,078 software developers and data experts.

Best JavaScript DOM Inspector (Browser)

Hi

Just wondering if anybody can recommend the best JavaScript based DOM
browser / inspector?

Like those ones:

http://www.informatrix.ch/joe/joe.html
http://javascript.internet.com/page-...m-browser.html

Thank you.

Jul 23 '05 #1
6 2070
Alex Vassiliev wrote:
Hi

Just wondering if anybody can recommend the best JavaScript based DOM
browser / inspector?

Like those ones:

http://www.informatrix.ch/joe/joe.html
http://javascript.internet.com/page-...m-browser.html


Just curious - what benefit does a JavaScript-based DOM inspector have
over one that is available for free as a browser extension?
--
Rob
Jul 23 '05 #2
RobG wrote:
Just curious - what benefit does a JavaScript-based DOM inspector have
over one that is available for free as a browser extension?


.... which might also be JavaScript based :-)
Jul 23 '05 #3
All regular benefits of web application:
(1) easy to deploy with my application
(2) multiple browsers compatibility

Plus, if source code is available, I can invoke it from my js
application when it is exactly in the state I wanted to inspect plus I
can pass the reference to the exact object I wanted to inspect.
RobG wrote:
Alex Vassiliev wrote:
Hi

Just wondering if anybody can recommend the best JavaScript based DOM
browser / inspector?

Like those ones:

http://www.informatrix.ch/joe/joe.html
http://javascript.internet.com/page-...m-browser.html


Just curious - what benefit does a JavaScript-based DOM inspector have
over one that is available for free as a browser extension?
--
Rob


Jul 23 '05 #4
Alex Vassiliev wrote:
All regular benefits of web application:
(1) easy to deploy with my application
(2) multiple browsers compatibility

Plus, if source code is available, I can invoke it from my js
application when it is exactly in the state I wanted to inspect plus I
can pass the reference to the exact object I wanted to inspect.

[...]

Here is a 'DOMwalk' script I wrote some time ago as a quick 'n dirty
tree dump. If you give domReport() an id it will walk down from there.
If no id is given, it starts from the html element. I've tested it in
most modern browsers and it seems to be fine.

Everything is listed in a table with a node reference, with a bit of
effort a better presentation is possible. Nodes could be listed as <li>
elements and each parent node could have an associated <ul> element with
an onclick that collapses the branch. Node attributes could be in a
<span> beneath each node and be shown/hidden when the node is clicked on.

I had intentions of doing at least some of the above, but it seemed
pointless given that a perfectly serviceable DOM inspector comes free
with Geko browsers (there are probably some for other browsers too but I
haven't bothered to look).

Let me know if you want the above functionality added.
--
Rob
Jul 23 '05 #5
RobG wrote:
Alex Vassiliev wrote:
All regular benefits of web application:
(1) easy to deploy with my application
(2) multiple browsers compatibility

Plus, if source code is available, I can invoke it from my js
application when it is exactly in the state I wanted to inspect plus I
can pass the reference to the exact object I wanted to inspect.

[...]

Here is a 'DOMwalk' script I wrote some time ago as a quick 'n dirty
tree dump. If you give domReport() an id it will walk down from there.
If no id is given, it starts from the html element. I've tested it in
most modern browsers and it seems to be fine.

[...]
And here's the script... :-x
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> DOMwalk </title>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
var rpt = [];
function domWalk(n,x) {
rpt.push('<tr><td>' + x
+ '</td><td>' + n.nodeName
+ '</td><td>' + n.nodeType
+ '</tr>');
for (var i=0; i<n.childNodes.length; i++) {
domWalk(n.childNodes[i],x+'.'+i);
}
}

function domReport(s){
rpt.length = 0;
rpt.push('<table><tr><th>Index</th>'
+ '<th>nodeName</th><th>nodeType</th></tr>');
if ( s && '' != s) {
domWalk(document.getElementById(s),'');
} else {
domWalk(document.getElementsByTagName('html')[0],'0');
}
rpt.push('</table>');
document.getElementById('xx').innerHTML = rpt.join('');
}
</script>
</head>
<body onload="domReport();">

<div>
<p>this stuff is just so that there is something
in the document to report on.</p>
<p>Here is <b>some</b> text</p>
<p>Here is <b>some</b> <i>text</i></p>
<p>Here is some text</p>
</div>

<div id="xx"></div>

</body>
</html>
--
Rob
Jul 23 '05 #6
I was thinking more about JS object members browser. Something you can
use to inrospect the available properties and methods of given class.
Plust the ability to jump (chenge the focus) on the references, etc.

There are DOM browsers like this one:
http://slayeroffice.com/?c=/content/tools/suite.html
or
javascript:s=document.body.appendChild(document.cr eateElement('script'));s.id='fs';s.language='javas cript';void(s.src='http://slayeroffice.com/tools/suite/suite.js');

which will let you browse the DOM, but not the pure JS object graph.

But thnank for your example anyway... I guess I can modify it like this
to achive my desired results:
function domWalk(n,x) {
var members = '';
for(var m in n) members += m+';';
rpt.push('<tr><td>' + x
+ '</td><td>' + n.nodeName
+ '</td><td>' + n.nodeType
+ '</td><td>' + members
+ '</tr>');
for (var i=0; i<n.childNodes.length; i++) {
domWalk(n.childNodes[i],x+'.'+i);
}
}

Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Bruce W.1 | last post: by
14 posts views Thread by Jeff Papineau | last post: by
2 posts views Thread by Praveen Ramesh | last post: by
136 posts views Thread by Matt Kruse | last post: by
19 posts views Thread by maya | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.