Text Selection API在哪里? [英] Where did the Text Selection API go?

查看:98
本文介绍了Text Selection API在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

两年前,HTML5标准删除了文本选择API一章,其中包含选择界面的规范:

Two years ago the HTML5 standard dropped the chapter "Text Selection API" which contained a specification of the Selection interface:

[Stringifies] interface Selection {
  readonly attribute Node anchorNode;
  readonly attribute long anchorOffset;
  readonly attribute Node focusNode;
  readonly attribute long focusOffset;
  readonly attribute boolean isCollapsed;
  void collapse(in Node parentNode, in long offset);
  void collapseToStart();
  void collapseToEnd();
  void selectAllChildren(in Node parentNode);
  void deleteFromDocument();
  readonly attribute long rangeCount;
  Range getRangeAt(in long index);
  void addRange(in Range range);
  void removeRange(in Range range);
  void removeAllRanges();
};

见这里: http://www.w3.org/TR/2009/WD-html5-20090423/editing.html#selection

我记得在另一个标准中遇到过这个界面,但我忘记了哪一个。有人可以刷新我的记忆吗?

I remember encountering this interface in another standard, but I forgot which one. Could anyone please refresh my memory?

推荐答案

它转移到WHATWG的 DOM范围规范。该文档的Range部分最近(在过去一周左右)已迁移到W3C的 DOM4规范

It moved to WHATWG's DOM Range spec. The Range portion of that document has very recently (within the last week or so) been migrated to W3C's DOM4 spec.

这使得WHATWG Range规范处于被误导的名称中。我不确定是否有计划再次移动选择内容,但我不打赌它。

This leaves the WHATWG Range spec in the position of being rather misleadlingly named. I'm not sure whether there are plans to move the Selection stuff again but I wouldn't bet against it.

规范的选择部分目前位于 HTML编辑API规范

The Selection portion of the spec is currently found in the HTML Editing APIs spec.

这篇关于Text Selection API在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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