热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

文档树与DOM相同?-DocumenttreeisthesameasDOM?

Hereisthesentence这是句子Thepseudo-classconceptisintroducedtopermitselectionbasedonin

Here is the sentence

这是句子

The pseudo-class concept is introduced to permit selection based on information that lies outside of the document tree or that cannot be expressed using the other simple selectors.

引入伪类概念以允许基于位于文档树之外的信息或者不能使用其他简单选择器表达的信息进行选择。

from http://www.w3.org/TR/selectors/#pseudo-classes

Is "document tree" have the same meaning as DOM or it's something else?

“文档树”与DOM具有相同的含义还是其他内容?

2 个解决方案

#1


12  

Yes.

DOM stands for document object model and describes the tree strcuture of elements that form the (HTML) document.

DOM代表文档对象模型,描述了构成(HTML)文档的元素的树形结构。

When the CSS spec talks about a document tree it refers to the same thing.

当CSS规范谈到文档树时,它指的是同一个东西。

In the sentence you've cited the document says the information, for example whether a link has been visited or not, is not stored in a DOM node.

在您引用的句子中,文档说明信息(例如是否已访问过链接)不存储在DOM节点中。

Take a look at this screenshot of the Firebug inspector showing a part of the DOM of this question and the DOM properties.

看一下Firebug检查器的这个屏幕截图,显示这个问题的DOM的一部分和DOM属性。

Firebug: Document tree excerpt of this question showing the link to the W3C docs and the DOM properties pane

In CSS you could create this selector and apply styles to a link that has been visited:

在CSS中,您可以创建此选择器并将样式应用于已访问过的链接:

a:visited {
    ...
}

There's no visited attribute in the DOM node that Javascript could access too, thus this informaion is outside the DOM tree.

在Javascript可以访问的DOM节点中没有访问过的属性,因此该信息在DOM树之外。

#2


4  

For the purposes of using CSS with HTML, whether you call it a document tree or a DOM tree doesn't make much of a difference. As an author working with HTML and CSS, all you need to know is that the tree is the structure of elements as marked up in the HTML.

为了将CSS与HTML结合使用,无论是将其称为文档树还是DOM树,都没有太大区别。作为使用HTML和CSS的作者,您需要知道的是树是HTML中标记的元素结构。

The DOM, short for Document Object Model, is a set of APIs through which elements of an HTML or XML document can be accessed and modified. Strictly speaking, the DOM, in itself, is not the document tree (or a document tree for that matter), but an interface to said tree (although the tree itself can be implemented according to the DOM). See What is the Document Object Model? in the DOM spec for a lengthy explanation.

DOM是文档对象模型的缩写,是一组API,通过它可以访问和修改HTML或XML文档的元素。严格来说,DOM本身不是文档树(或文档树),而是所述树的接口(尽管树本身可以根据DOM实现)。请参阅什么是文档对象模型?在DOM规范中进行了长时间的解释。

Furthermore, a document tree may not necessarily be represented or interfaced with by the DOM, since CSS may be used to style things other than HTML or XML DOM trees. The DOM provides just one implementation of the concept of a "document tree". This is why the Selectors spec (and related specs) never refer to the document tree as "the DOM" or "the DOM tree", except when specifically referring to the DOM standard.

此外,文档树可能不一定由DOM表示或接口,因为CSS可用于对除HTML或XML DOM树之外的事物进行样式化。 DOM仅提供“文档树”概念的一种实现。这就是选择器规范(和相关规范)从未将文档树称为“DOM”或“DOM树”的原因,除非专门引用DOM标准。

The definition of a "document tree" according to CSS, then, can be found in the CSS2.1 spec:

那么,根据CSS的“文档树”的定义可以在CSS2.1规范中找到:

Document tree
The tree of elements encoded in the source document. Each element in this tree has exactly one parent, with the exception of the root element, which has none.

文档树源文档中编码的元素树。此树中的每个元素只有一个父元素,但根元素除外,它没有。

When the source document language is HTML or XML, and the implementation used is the DOM, the resulting document tree is a DOM tree.

当源文档语言是HTML或XML,并且使用的实现是DOM时,生成的文档树是DOM树。


推荐阅读
  • 本文由编程笔记#小编为大家整理,主要介绍了logistic回归(线性和非线性)相关的知识,包括线性logistic回归的代码和数据集的分布情况。希望对你有一定的参考价值。 ... [详细]
  • 生成式对抗网络模型综述摘要生成式对抗网络模型(GAN)是基于深度学习的一种强大的生成模型,可以应用于计算机视觉、自然语言处理、半监督学习等重要领域。生成式对抗网络 ... [详细]
  • VScode格式化文档换行或不换行的设置方法
    本文介绍了在VScode中设置格式化文档换行或不换行的方法,包括使用插件和修改settings.json文件的内容。详细步骤为:找到settings.json文件,将其中的代码替换为指定的代码。 ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 本文分享了一个关于在C#中使用异步代码的问题,作者在控制台中运行时代码正常工作,但在Windows窗体中却无法正常工作。作者尝试搜索局域网上的主机,但在窗体中计数器没有减少。文章提供了相关的代码和解决思路。 ... [详细]
  • Linux重启网络命令实例及关机和重启示例教程
    本文介绍了Linux系统中重启网络命令的实例,以及使用不同方式关机和重启系统的示例教程。包括使用图形界面和控制台访问系统的方法,以及使用shutdown命令进行系统关机和重启的句法和用法。 ... [详细]
  • 本文介绍了九度OnlineJudge中的1002题目“Grading”的解决方法。该题目要求设计一个公平的评分过程,将每个考题分配给3个独立的专家,如果他们的评分不一致,则需要请一位裁判做出最终决定。文章详细描述了评分规则,并给出了解决该问题的程序。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef ... [详细]
  • IOS开发之短信发送与拨打电话的方法详解
    本文详细介绍了在IOS开发中实现短信发送和拨打电话的两种方式,一种是使用系统底层发送,虽然无法自定义短信内容和返回原应用,但是简单方便;另一种是使用第三方框架发送,需要导入MessageUI头文件,并遵守MFMessageComposeViewControllerDelegate协议,可以实现自定义短信内容和返回原应用的功能。 ... [详细]
  • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
  • 本文讨论了微软的STL容器类是否线程安全。根据MSDN的回答,STL容器类包括vector、deque、list、queue、stack、priority_queue、valarray、map、hash_map、multimap、hash_multimap、set、hash_set、multiset、hash_multiset、basic_string和bitset。对于单个对象来说,多个线程同时读取是安全的。但如果一个线程正在写入一个对象,那么所有的读写操作都需要进行同步。 ... [详细]
  • 开源Keras Faster RCNN模型介绍及代码结构解析
    本文介绍了开源Keras Faster RCNN模型的环境需求和代码结构,包括FasterRCNN源码解析、RPN与classifier定义、data_generators.py文件的功能以及损失计算。同时提供了该模型的开源地址和安装所需的库。 ... [详细]
  • HashMap的相关问题及其底层数据结构和操作流程
    本文介绍了关于HashMap的相关问题,包括其底层数据结构、JDK1.7和JDK1.8的差异、红黑树的使用、扩容和树化的条件、退化为链表的情况、索引的计算方法、hashcode和hash()方法的作用、数组容量的选择、Put方法的流程以及并发问题下的操作。文章还提到了扩容死链和数据错乱的问题,并探讨了key的设计要求。对于对Java面试中的HashMap问题感兴趣的读者,本文将为您提供一些有用的技术和经验。 ... [详细]
  • 本文介绍了Python语言程序设计中文件和数据格式化的操作,包括使用np.savetext保存文本文件,对文本文件和二进制文件进行统一的操作步骤,以及使用Numpy模块进行数据可视化编程的指南。同时还提供了一些关于Python的测试题。 ... [详细]
author-avatar
Bella团
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有