对 DOM 和 HTML (API) 之间的关系感到困惑 [英] Confused by relation between DOM and HTML (APIs)

查看:34
本文介绍了对 DOM 和 HTML (API) 之间的关系感到困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DOM 和 HTML 有什么关系?一个子集是另一个子集,一个比另一个更抽象的概念吗?HTML 是 DOM 的扩展吗?或者它们是否描述了相当不相关的概念(相关仅在于您可以从 HTML 转换为 DOM)?如果必须的话,你会如何将这两个画在一张图片中?

How are DOM and HTML related? Is one subset of another, is one a more abstract concept than the another? Is HTML an extension of DOM? Or do they describe rather unrelated concepts (related only in that you can transform from HTML into DOM)? How would you draw these 2 in one picture if you had to?

例如,这些差异规范的目的是什么.第一个和最后一个链接都包含有关 HTMLElement 的信息..

For example, what is the purpose of these difference specs. Both first and last links contain information about HTMLElement..

  1. http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/
  2. http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/
  3. http://www.w3.org/TR/html5/

我在这里找到了这个问题的可能答案:http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-1176245063-h2,这是

I found a possible answer to this question here: http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-1176245063-h2, which is

特定于 HTML 的 DOM API 的目标是:

The goals of the HTML-specific DOM API are:

  • 专门化和添加专门与 HTML 文档和元素相关的功能
  • ...
  • 在适当的情况下,为 HTML 文档的常见和频繁操作提供便利机制.

这是否意味着上面列表中的第三个链接扩展了 DOM 核心,这在第一个链接中进行了描述?

Does this mean that the 3rd link in the list above extends the DOM Core, which is described in the 1st link?

或者,如果您实现了 DOM Core,它允许您操作简单的文档,但是如果您实现了 HTML,那么您就像一个超级 DOM,允许您操作更复杂的对象?

Or if you implement DOM Core, that allows you to manipulate simple documents, but if you implement HTML, that gives you like a super-DOM that allows you to manipulate more complicated objects?

最后,假设您想实现自己的浏览器,该浏览器只能打开 HTML5 网站(呈现,并支持 JavaScript).阅读第 3 个链接中的规范就足够了,还是需要先实现 DOM 中提供的所有内容,然后再实现 HTML5 特定的内容?

Finally, say you want to implement your own browser that is able to open only HTML5 websites (render, as well as support JavaScript). Is it enough to read the specification found in the 3rd link, or do you first need to implement everything provided in DOM and then implement HTML5 specific things?

更新
我想我想知道 DOM API vs HTML API vs DOM HTML API vs HTML DOM API.

UPDATE
I guess I'm wondering about DOM API vs HTML API vs DOM HTML API vs HTML DOM API.

推荐答案

HTML 是文本,DOM 是内存中的对象模型,用于表示 HTML 描述的树.

HTML is text and the DOM is the in-memory object model to represent the tree that the HTML described.

这篇关于对 DOM 和 HTML (API) 之间的关系感到困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆