By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,200 Members | 1,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,200 IT Pros & Developers. It's quick & easy.

Best JavaScript DOM Inspector (Browser)

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.