【发布时间】:2011-11-20 06:05:34
【问题描述】:
两年前,HTML5 标准删除了“文本选择 API”一章,其中包含 Selection 接口的规范:
[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
我记得在另一个标准中遇到过这个接口,但我忘记了是哪一个。谁能刷新我的记忆?
【问题讨论】:
标签: javascript html interface selection