gpt4 book ai didi

Javascript DOM 对象图

转载 作者:数据小太阳 更新时间:2023-10-29 04:15:08 24 4
gpt4 key购买 nike

我一直在寻找一个好的 DOM 对象图供 javascript 使用。
我知道搜索 javascript DOM object diagram 会给出很多这样的图,比如这个看起来很清楚的图:

enter image description here

你们中有人有更完整的 DOM 和 javascript 关系吗?

最佳答案

给定 DOM 树的一小部分:

<html>
|
+-- <head>
| |
| +...
|
+-- #text
|
+-- <body>
|
+...

即使您只保留属性(没有方法)并且只保留那些指向 Node 的属性(没有属性、样式、没有文本或数字属性),排除特定于 HTML 的 API(例如那些在你的图表上的)并省略一些属性,你仍然会得到一个复杂的图表(请原谅我糟糕的 graphviz 技能):

enter image description here

(这里的框是对象,以其最派生的 DOM 接口(interface)名称标记,边以属性标记)。

为不同类别的 DOM API 生成多个“备忘单”可能会很有趣,但您可以详细说明为什么以及在什么情况下您所讨论的图表有用。

我自己,我找到了 developer.mozilla.org's DOM reference ,相关规范,和http://docs.jquery.com对于 jQuery 足够了。


附言graphviz 图的来源以备不时之需:

digraph {   //rankdir=LR;
// size="30,10";
node [shape="rect"];
Window -> Document [label="document"];
Document -> Window [label="defaultView"];
Document -> "Element (<html>)" [label="documentElement"];
"Element (<html>)" -> Document [label="ownerDocument"];

html [label="Element (<html>)"];
head [label="Element (<head>)"];
textBetweenHeadBody [label="Text"];
body [label="Element (<body>)"];

html -> head [label="firstChild,\nchildNodes[0]\nchildren[0]"];
head -> html [label="parentNode" color=grey fontcolor=grey];
html -> textBetweenHeadBody [label="childNodes[1]"];
html -> body [label="lastChild\nchildNodes[2]\nchildren[1]"];
body -> html [label="parentNode" color=grey fontcolor=grey];

head -> textBetweenHeadBody [label="nextSibling"];
textBetweenHeadBody -> head [label="previousSibling"];
textBetweenHeadBody -> body [label="nextSibling"];
body -> textBetweenHeadBody [label="previousSibling"];

head -> body [label="nextElementSibling\npreviousElementSibling" fontcolor="blue" color="blue" dir=both];
//body -> head [label=""];


{rank=same; head textBetweenHeadBody body}

}

关于Javascript DOM 对象图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8285895/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com