[英]Accessing the DOM via chrome console
Some questions regarding the DOM and what it exactly is. 有关DOM及其确切含义的一些问题。
When I access document
via console.dir
I get all the properties of document
like this: 当我访问document
通过console.dir
我得到的所有属性document
是这样的:
When I do a console.log
I get something which looks more like the DOM: 当我执行console.log
我得到的东西看起来更像是DOM:
console.log()
is the DOM. 以我的理解,我们从console.log()
获得的第二个对象是DOM。 and the one from console.dir()
is the DOM and all the Javascript properties which exists on the DOM. 而console.dir()
的一个是DOM和DOM上存在的所有Javascript属性。 Is this correct? 这个对吗? console.log(window.document)
from a property of console.dir(window.document)
? 我们可以访问我们从中获取元素节点的DOM结构console.log(window.document)
从属性console.dir(window.document)
The DOM (Document Object Model) is a generic term for a set of objects. DOM(文档对象模型)是一组对象的通用术语。
document
is a DOM object; document
是DOM对象; you're just seeing two different ways of representing it. 您只是看到两种不同的表示方式。
You can access the DOM hierarchy via properties like .children
. 您可以通过.children
属性访问DOM层次结构。
For more information, see the documentation . 有关更多信息,请参见文档 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.