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

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

问题描述

DOM和HTML如何相关?是另一个的一个子集,是一个比另一个更抽象的概念? HTML是DOM的扩展吗?或者他们描述相当不相关的概念(仅与您可以从HTML转换为DOM相关)?如果你不得不在一张照片中绘制这些2,你将如何?

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/

  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:


  • 专门化和添加与specificall相关的功能y到HTML文档和元素

  • ...

  • 提供方便的机制,适用于HTML文档的常见和频繁操作。 li>
  • to specialize and add functionality that relates specifically to HTML documents and elements
  • ...
  • to provide convenience mechanisms, where appropriate, for common and frequent operations on HTML documents.

这是否意味着上面列表中的第3个链接扩展了DOM Core,第一个链接?

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)。阅读第三个链接中的规范是否足够,或者您是否首先需要实现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对HTML API与DOM HTML API与HTML DOM API的关系。

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

推荐答案

简而言之:

HTML标准定义了HTML语言 - 哪些标签/属性存在以及它们的含义。

The HTML standards define the HTML language - which tags / attributes exist and what they mean.

DOM标准定义了由浏览器中的DOM对象树中的对象实现的接口。 (Web浏览器解析HTML源代码,并根据它创建一个对象树,该树中的对象具有由DOM(和其他)标准定义的属性。)

The DOM standards define interfaces that are implemented by the objects from the DOM object tree in the browser. (The web-browser parses the HTML source code and creates an object tree based on it. The objects in that tree have properties which are defined by DOM (and other) standards.)

HTML5标准还定义了以前未定义的内容的界面,如窗口对象,导航器和历史记录对象,全局函数,如警报和提示,超时功能等。

The HTML5 standard also defines interfaces for stuff that wasn't defined before - like the window object, the navigator and history object, global functions like alert and prompt, timeout functions, etc.

不同的标准不是彼此的子集 - 它们只是定义整个图片的不同标准。

The different standards are not subsets of each other - they are just distinct standards that define a piece of the whole picture.

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

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