[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: DOM and konqueror
From:       Peter Kelly <pmkelly () dingoblue ! net ! au>
Date:       2001-04-05 9:57:55
[Download RAW message or body]

Gioele Barabucci wrote:
> Is possible to ask konqueror to print the DOM tree (Level 1) of the curre> nt 
> page? How? I do not see any menu to do this...
>
> -- 
> Gioele Barabucci (Gb]) 
> ) mailto:dev@gioelebarabucci.com
> ) http://www.gioelebarabucci.com
> ) ) I've been and now I've gone
> ) )          /Magic Pie^Oasis

There is no menu item, but there are other ways to see it. You can use testkhtml
(in kdelibs/khtml) to view the page and a DOM tree window will appear, or you
can use the following javascript code to print the tree to stdout:

function printNodeTree(n,depth) {
  var i;
  var line = '';
  for (i = 0; i < depth; i++)
    line += '  ';
  line += n.nodeName;
  if (n.nodeValue) {
    line += ': "'+n.nodeValue+'"';
  }
  debug(line);
  var c;
  for (c = n.firstChild; c != null; c = c.nextSibling) {
    printNodeTree(c,depth+1);
  }
}

printNodeTree(document,0);

--
Peter Kelly
pmk@post.com

>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic