0

Just wondering if it's possible to print and list all methods and attributes available to the DOM document itself using Javascript?

So I would get something like so:

Document.doctype Document.implementation Document.documentElement Document.createElement Document.createDocumentFragment Document.createTextNode Document.createComment Document.createProcessingInstruction etc... etc...

I want to do this to test on different browsers and not have to wade through mountains technical documents from each vendor to get accurate information.

EddyR
  • 6,891
  • 7
  • 42
  • 50

1 Answers1

1

You could use:

for (var l in document.body){
  console.log("document."+l+":"+document.body[l]);
}
KooiInc
  • 119,216
  • 31
  • 141
  • 177
  • What about for example DOMImplementation.hasFeature, NodeList.length, etc or even Node? Are these interfaces not exposed to Javascript? – EddyR Jun 12 '10 at 11:05
  • Actually I can get the Node constants for example Node.ELEMENT_NODE:1 but once it reaches its methods it returns Node.toString:function toString() { [native code] } It's the same for DOMImplementation, etc (but Document is fine.) – EddyR Jun 12 '10 at 11:17
  • For DOMImplementation, enumerate on `document.implementation` and for Node likewise. To see properties inherited from the prototype chain, inspect Node.prototype – Anurag Jun 13 '10 at 02:15