URL Fragment Text Directives

URL 片段文本指令 API 允许 Web 应用程序与 URL 中的文本片段进行交互。文本片段允许直接链接到 Web 文档中的特定文本部分,而无需作者使用 URL 片段中的特定语法为其添加 ID。

接口

FragmentDirective

一个(目前)为空的对象。此类型对象在 document.fragmentDirective 中的存在用于特性检测。

其他接口的扩展

Document.fragmentDirective

一个属性,返回当前文档的 FragmentDirective 对象。目前仅用于特性检测。

CSS 选择器

::target-text

表示已滚动到的文本。它允许作者选择如何突出显示该部分文本。

规范

规范
URL Fragment Text Directives
# dom-document-fragmentdirective
URL Fragment Text Directives
# fragmentdirective
CSS 伪元素模块 Level 4
# selectordef-target-text

浏览器兼容性

api.Document.fragmentDirective

api.FragmentDirective

css.selectors.target-text

另见